X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..6465356a983ac139f81d3b7913cdb548477c346c:/stdlib/FreeBSD/alloca.3 diff --git a/stdlib/FreeBSD/alloca.3 b/stdlib/FreeBSD/alloca.3 index 9866edf..492100a 100644 --- a/stdlib/FreeBSD/alloca.3 +++ b/stdlib/FreeBSD/alloca.3 @@ -34,25 +34,25 @@ .Sh NAME .Nm alloca .Nd memory allocator -.Sh LIBRARY -.Lb libc .Sh SYNOPSIS +.In alloca.h +or +.br .In stdlib.h .Ft void * .Fn alloca "size_t size" .Sh DESCRIPTION The .Fn alloca -function +macro allocates .Fa size bytes of space in the stack frame of the caller. This temporary space is automatically freed on return. .Sh RETURN VALUES -The .Fn alloca -function returns a pointer to the beginning of the allocated space. +returns a pointer to the beginning of the allocated space. .Sh SEE ALSO .Xr brk 2 , .Xr calloc 3 , @@ -60,24 +60,20 @@ function returns a pointer to the beginning of the allocated space. .Xr malloc 3 , .Xr realloc 3 .Sh HISTORY -The .Fn alloca -function appeared in +appeared in .At 32v . .\" .Bx ?? . .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd .\" The first man page (or link to a man page that I can find at the .\" moment is 4.3... .Sh BUGS -The .Fn alloca -function is machine and compiler dependent; its use is discouraged. .Pp -The .Fn alloca -function is slightly unsafe because it cannot ensure that the pointer +is slightly unsafe because it cannot ensure that the pointer returned points to a valid and usable block of memory. The allocation made may exceed the bounds of the stack, or even go further into other objects in memory, and @@ -86,3 +82,8 @@ cannot determine such an error. Avoid .Fn alloca with large unbounded allocations. +.Pp +The use of C99 variable-length arrays and +.Fn alloca +in the same function will cause the lifetime of alloca's storage to be limited to the block containing the +.Fn alloca