O nás     Inzerce     KontaktSpolehlivé informace o IT již od roku 2011
Hledat
Nepřehlédněte: 2. kolo: Pozoruhodné IT produkty 2020
Správa dokumentů
Digitální transformace
Informační systémy
Hlavní rubriky: Informační systémy, Mobilní technologie, Datová centra, Sítě, IT bezpečnost, Software, Hardware, Zkušenosti a názory, Speciály

Pozoruhodné IT produkty 2020
E-knihy o IT zdarma
Odborné IT konference BusinessIT
Manuál Linux
[Linux manuál]

alloca: alokátor paměti

Originální popis anglicky: alloca - memory allocator

Návod, kniha: Linux Programmer's Manual

STRUČNĚ

#include <alloca.h>
 
void *alloca(size_t size);

POPIS / INSTRUKCE

The alloca function allocates size bytes of space in the stack frame of the caller. This temporary space is automatically freed when the function that called alloca returns to its caller.

NÁVRATOVÁ HODNOTA

The alloca function returns a pointer to the beginning of the allocated space. If the allocation causes stack overflow, program behaviour is undefined.

ODPOVÍDAJÍCÍ

There is evidence that the alloca function appeared in 32v, pwb, pwb.2, 3bsd, and 4bsd. There is a man page for it in BSD 4.3. Linux uses the GNU version. This function is not in POSIX or SUSv3.

NOTES ON THE GNU VERSION

Normally, gcc translates calls to alloca by inlined code. This is not done when either the -ansi or the -fno-builtin option is given. But beware! By default the glibc version of <stdlib.h> includes <alloca.h> and that contains the line
# define alloca(size) __builtin_alloca (size)
with messy consequences if one has a private version of this function.
The fact that the code is inlined, means that it is impossible to take the address of this function, or to change its behaviour by linking with a different library.
The inlined code often consists of a single instruction adjusting the stack pointer, and does not check for stack overflow. Thus, there is no NULL error return.

BUGS

The alloca function is machine and compiler dependent. On many systems its implementation is buggy. Its use is discouraged.
On many systems alloca cannot be used inside the list of arguments of a function call, because the stack space reserved by alloca would appear on the stack in the middle of the space for the function arguments.

SOUVISEJÍCÍ

brk(2), pagesize(2), calloc(3), malloc(3), realloc(3)
2002-07-17 GNU
©2011-2020 BusinessIT.cz, ISSN 1805-0522 | Názvy použité v textech mohou být ochrannými známkami příslušných vlastníků.
Provozovatel: Bispiral, s.r.o., kontakt: BusinessIT(at)Bispiral.com | Inzerce: Best Online Media, s.r.o., zuzana@online-media.cz
O vydavateli | Pravidla webu BusinessIT.cz a ochrana soukromí | pg(8974)