Re: Man Page `alloca()`: Important Info Is Missing?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Robin Kuzmin:

> http://man7.org/linux/man-pages/man3/alloca.3.html
>
> I compare this man page with the
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?view=vs-2017
> and I feel that a very important fragment is missing in the man page
> (although strictly speaking the man page is complete), the missing
> fragment is between the double asterisks (**):
>
> The allocated space is automatically freed when the calling function
> exits **(not when the allocation merely passes out of scope)**.

Note that this is only true for the Microsoft compiler.  For GCC, the
rules are different: An allocation with with alloca is freed when the
closest enclosing scope with a VLA declaration is exited, and if no such
scope exists, when the function is exited.  This includes abnormal exits
(through stack unwinding).  The GCC documentation suggests something
else; I will try to get it corrected.

Thanks,
Florian



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux