On 6/10/19 8:24 AM, Martin Liška wrote: > I've just noticed that we have couple of alloca (0) in libiberty: > > #ifndef REGEX_MALLOC > # ifdef C_ALLOCA > alloca (0); > # endif > #endif > > If I'm correct the value 0 has a special meaning that tells a C library > to clean up all previous alloca allocations. > > man alloca does not document the behavior
I'm sure it doesn't. This alloca(0) behaviour is a libiberty-internal thing. > Question is how legacy is alloca call from a standard library? alloca(3) is implemented by GCC as a builtin. It's fast, simple, and widely used. These days you might use variable-length arrays instead, which are at least portable. Is there some problem that you want to solve? -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671