Add copyright notices to long-enough files that lack them, since
[gnulib.git] / doc / alloca-opt.texi
1 @c Documentation of gnulib module 'alloca-opt'.
2
3 @c Copyright (C) 2004 Free Software Foundation, Inc.
4
5 @c Permission is granted to copy, distribute and/or modify this document
6 @c under the terms of the GNU Free Documentation License, Version 1.2 or
7 @c any later version published by the Free Software Foundation; with no
8 @c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
9 @c Texts.  A copy of the license is included in the ``GNU Free
10 @c Documentation License'' file as part of this distribution.
11
12 The alloca-opt module provides for a function alloca() which allocates memory
13 on the stack, where the system allows it. A memory block allocated with alloca()
14 exists only until the function that calls alloca() returns or exits abruptly.
15
16 There are a few systems where this is not possible: HP-UX systems, and some
17 other platforms when the C++ compiler is used. On these platforms the alloca-opt
18 module provides no replacement, just a preprocessor macro HAVE_ALLOCA.
19
20 The user can #include <alloca.h> on all platforms, and use alloca() on those
21 platforms where the preprocessor macro HAVE_ALLOCA evaluates to true. If
22 HAVE_ALLOCA is false, the code should use a heap-based memory allocation
23 based on malloc() or - in C++ - 'new'. Note that the #include <alloca.h> must be
24 the first one after the autoconf-generated config.h. Thanks to AIX for this nice
25 restriction!