alloca(3C)
alloca - Allocates dynamic space
As shipped in IRIX 6.5.15. Last changed in IRIX 6.5.5.
NAME alloca - Allocates dynamic space SYNOPSIS #include <alloca.h> void *alloca (unsigned size); IMPLEMENTATION IRIX systems DESCRIPTION alloca returns a pointer to size bytes of uninitialized local stack space. Because the space is allocated using a built-in compiler function, the allocation is quite fast. If zero is passed as size, alloca returns a valid pointer (unlike some versions of malloc, which consider a zero size to be an error). The #include <alloca.h> is required. Space allocated when a function foo calls alloca is freed automatically when foo returns. It is an error to call free with a pointer returned by alloca. Not all environments have alloca in their libraries, so code using it is not necessarily portable. Reasonably portable public domain versions of this function are available from various sources on the Internet and the World Wide Web. FILES /usr/include/alloca.h DIAGNOSTICS In this implementation, alloca cannot fail (although if size makes the process too large IRIX may kill the process). Because alloca always returns a valid pointer, no diagnostics are possible. Portability may be enhanced if the function calling alloca tests for a return value of 0 and handles 0 as an error. CAVEATS Do not call alloca as an argument to another function, as in foo(alloca(20));. Use the following example instead: cp = alloca(20); foo(cp); SEE ALSO malloc(3), calloc(3), free(3) This man page is available only online.