Standards / Extensions | C or C++ | Dependencies |
---|---|---|
both | OS/390 V2R6 |
#include <stdlib.h>
void *alloca(unsigned int size);
The built-in alloca() function obtains memory from the stack. This eliminates the need for an explicit free() as the memory is freed when the stack is collapsed.
If the alloca() function is unable to obtain the requested storage, control will not return to the caller. Instead the application will terminate due to an out of memory condition (if the reserve stack is available and the caller is not XPLINK), or it will terminate with an abend indicating that storage could not be obtained.
To avoid infringing on the user's name space, this nonstandard function is exposed only when you use the compiler option, LANGLVL(EXTENDED). When you use LANGLVL(EXTENDED) any relevant information in the header is also exposed.
If successful, alloca() returns the address of the requested storage.