Provided by: manpages-pl-dev_4.18.1-1_all bug

NAZWA

       alloca - przydzielanie pamięci, która jest automatycznie zwalniana

BIBLIOTEKA

       Standardowa biblioteka C (libc, -lc)

SKŁADNIA

       #include <alloca.h>

       void *alloca(size_t rozmiar);

OPIS

       Funkcja  alloca()  przydziela  rozmiar  bajtów  pamięci na ramce stosu procedury, z której
       została wywołana. Ta  tymczasowa  przestrzeń  jest  automatycznie  zwalniana  po  powrocie
       funkcji, która wywołuje alloca() do miejsca wywołania.

WARTOŚĆ ZWRACANA

       Funkcja  alloca()  zwraca  wskaźnik  do  początku przydzielonej pamięci. Gdy przydzielenie
       pamięci spowoduje przepełnienie stosu, zachowanie programu nie jest określone.

ATRYBUTY

       Informacje  o  pojęciach  używanych  w  tym  rozdziale   można   znaleźć   w   podręczniku
       attributes(7).

       ┌──────────────────────────────────────────────────────┬────────────────────────┬─────────┐
       │InterfejsAtrybutWartość │
       ├──────────────────────────────────────────────────────┼────────────────────────┼─────────┤
       │alloca()                                              │ Bezpieczeństwo wątkowe │ MT-Safe │
       └──────────────────────────────────────────────────────┴────────────────────────┴─────────┘

STANDARDY

       Funkcja nie występuje w POSIX.1.

       alloca()  originates from PWB and 32V, and appears in all their derivatives.

UWAGI

       The  alloca()  function is machine- and compiler-dependent.  Because it allocates from the
       stack, it's faster than malloc(3)  and free(3).  In certain cases, it  can  also  simplify
       memory deallocation in applications that use longjmp(3)  or siglongjmp(3).  Otherwise, its
       use is discouraged.

       Ponieważ przestrzeń alokowana przez alloca() jest przydzielana  z  przestrzeni  stosu,  to
       przestrzeń  ta jest automatycznie zwalniana, jeśli nastąpi przeskoczenie powrotu z funkcji
       przez wywołanie longjmp(3) lub siglongjmp(3).

       The space allocated by alloca()  is not automatically  deallocated  if  the  pointer  that
       refers to it simply goes out of scope.

       Pamięci przydzielonej przez alloca() nie można zwalniać za pomocą free(3)!

       By  necessity,  alloca()   is  a  compiler built-in, also known as __builtin_alloca().  By
       default, modern compilers automatically translate all uses of alloca()  into the built-in,
       but  this  is  forbidden  if standards conformance is requested (-ansi, -std=c*), in which
       case <alloca.h> is required, lest a symbol dependency be emitted.

       The fact that alloca()  is a built-in means it is impossible to take  its  address  or  to
       change its behavior by linking with a different library.

       Variable length arrays (VLAs) are part of the C99 standard, optional since C11, and can be
       used for a similar purpose.  However, they  do  not  port  to  standard  C++,  and,  being
       variables,  live  in  their block scope and don't have an allocator-like interface, making
       them unfit for implementing functionality like strdupa(3).

BŁĘDY

       Due to the nature of the stack, it is impossible to check if the allocation would overflow
       the space available, and, hence, neither is indicating an error.  (However, the program is
       likely to receive a SIGSEGV signal if it attempts to access unavailable space.)

       W wielu systemach alloca() nie może być używana w obrębie  listy  argumentów  w  wywołaniu
       funkcji,  gdyż  zarezerwowana  przez  alloca()  przestrzeń  stosu  znalazłaby się w środku
       przestrzeni stosu przeznaczonej na argumenty funkcji.

ZOBACZ TAKŻE

       brk(2), longjmp(3), malloc(3)

TŁUMACZENIE

       Autorami  polskiego  tłumaczenia   niniejszej   strony   podręcznika   są:   Adam   Byrtek
       <alpha@irc.pl>,   Andrzej   Krzysztofowicz   <ankry@green.mf.pg.gda.pl>,   Robert  Luberda
       <robert@debian.org> i Michał Kułach <michal.kulach@gmail.com>

       Niniejsze tłumaczenie jest wolną dokumentacją. Bliższe  informacje  o  warunkach  licencji
       można   uzyskać   zapoznając   się   z   GNU   General   Public   License   w   wersji   3
       ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩  lub  nowszej.  Nie   przyjmuje   się   ŻADNEJ
       ODPOWIEDZIALNOŚCI.

       Błędy  w  tłumaczeniu  strony  podręcznika  prosimy  zgłaszać  na  adres listy dyskusyjnej
       ⟨manpages-pl-list@lists.sourceforge.net⟩.