Why the use of alloca() is discouraged?
Answers were Sorted based on User's Feedback
Answer / johnson
Sorry, that is not strictly correct. According to the man page:
"The alloca() function allocates size bytes of space in the
stack frame of the caller, and returns a pointer to the
allocated block. This temporary space is automatically freed
when the caller returns."
Now this is the real reason:
" If the allocated block is beyond the current stack limit,
the resulting behavior is undefined."
| Is This Answer Correct ? | 12 Yes | 0 No |
Answer / sathish kumar
Hi All,
If you use alloca inside a function when it retuns from
function it will be resulting in memory leak. Thats why
its discouraged to use.
Thanks & Regards
Sathish Kumar
| Is This Answer Correct ? | 2 Yes | 5 No |
Write a pro-gramme to determine whether the number is even or odd?
What is data structure in c and its types?
output for following code??? main() { int x=2,y,z; x*=3+2; printf("1.%d\n",x); x*=y=z=4; printf("2.%d %d %d\n",x,y,z); x=y==z; printf("3.%d\n",x); x==(y=z); printf("%d",x); }
a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? a.infinite b.5 c.4 d.6
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
What is the difference between malloc() and calloc()?
Why is event driven programming or procedural programming, better within specific scenario?
What is class and object in c?
Function calling procedures? and their differences? Why should one go for Call by Reference?
What is the significance of scope resolution operator?
0 Answers Agilent, ZS Associates,
Is c object oriented?
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area