Main Page | Alphabetical List | Class List | File List | Class Members | File Members

alloca.h File Reference

defines the alloca() function More...

#include <nlibc.h>
#include <stddef.h>

Include dependency graph for alloca.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define alloca(SIZE)   __builtin_alloca(SIZE)

Functions

void * alloca (size_t)


Detailed Description

defines the alloca() function

Id
alloca.h,v 2.3 2005/10/27 20:04:44 morinl Exp

Definition in file alloca.h.


Define Documentation

#define alloca SIZE   )     __builtin_alloca(SIZE)
 

Definition at line 59 of file alloca.h.

Referenced by stringexpand().


Function Documentation

alloca size_t   ) 
 

NAME
alloca - memory allocator

SYNOPSIS
#include <alloca.h>

void *alloca(size_t size);

DESCRIPTION
The alloca function allocates size bytes of space in the stack frame of
the caller. This temporary space is automatically freed when the
function that called alloca returns to its caller.

RETURN VALUE
The alloca function returns a pointer to the beginning of the allocated
space. If the allocation causes stack over­ flow, program behaviour
is undefined.

CONFORMING TO
There is evidence that the alloca function appeared in 32v, pwb, pwb.2,
3bsd, and 4bsd. There is a man page for it in BSD 4.3.
This function is not in POSIX or SUSv3.

NOTES
The fact that the code is inlined, means that it is impossible to take
the address of this function, or to change its behaviour by linking with
a different library.

BUGS
On many systems (inluding apeNEXT) alloca cannot be used inside the list
of arguments of a function call, because the stack space reserved by
alloca would appear on the stack in the middle of the space for the
function arguments.

The inlined code consists of a few instructions adjusting the stack
pointer and does not check for stack overflow. Thus, there is no NULL
error return.
IMPLEMENTATION for apeNEXT:
done. No stack checking yet. The parameter size MUST be in bytes AND take alignments into account. See sizeof_aligned().


Generated on Fri Jul 14 10:51:35 2006 for nlibc by doxygen 1.3.5