*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> standard/alloca (3)              
Title
Content
Arch
Section
 

Contents


ALLOCA(3C)							    ALLOCA(3C)


NAME    [Toc]    [Back]

     alloca - allocate dynamic space

SYNOPSIS    [Toc]    [Back]

     #include <alloca.h>

     void *alloca (unsigned size);

DESCRIPTION    [Toc]    [Back]

     alloca returns a pointer to size bytes of uninitialized local stack
     space.  Since 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.

SEE ALSO    [Toc]    [Back]

      
      
     malloc(3),	calloc(3), free(3), /usr/include/alloca.h

DIAGNOSTICS    [Toc]    [Back]

     In	this implementation alloca cannot fail (though if size makes the
     process too large IRIX may	kill the process).  Since 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    [Toc]    [Back]

     Do	not call alloca	as an argument to another function, as in
     foo(alloca(20));.	Instead	use, for example, cp = alloca(20); foo(cp);.


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
malloc Linux Allocate and free dynamic memory
copy NetBSD kernel space to/from user space copy functions
copyin NetBSD kernel space to/from user space copy functions
copyinstr NetBSD kernel space to/from user space copy functions
copyout NetBSD kernel space to/from user space copy functions
copystr NetBSD kernel space to/from user space copy functions
copyoutstr NetBSD kernel space to/from user space copy functions
copyin_proc NetBSD kernel space to/from user space copy functions
copyout_proc NetBSD kernel space to/from user space copy functions
copyoutstr Tru64 General: Copies a null-terminated string from a kernel address space to a user address space
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service