I can't see any alloca.h
equivalent in Visual C 2010
. How can one perform stack allocation in Visual C
on Windows? I miss the function alloca
.
The alloca() function is machine- and compiler-dependent. For certain applications, its use can improve efficiency compared to the use of malloc(3) plus free(3). In certain cases, it can also simplify memory deallocation in applications that use longjmp(3) or siglongjmp(3). Otherwise, its use is discouraged.
alloca() allocates memory on the stack rather than on the heap, as in the case of malloc() . So, when I return from the routine the memory is freed. So, actually this solves my problem of freeing up dynamically allocated memory.
See _alloca
. Visual C uses an _ prefix for non-standard functions in the C headers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With