.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) 1980, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" SPDX-License-Identifier: BSD-4-Clause-UC .\" .\" @(#)alloca.3 5.1 (Berkeley) 5/2/91 .\" .\" Converted Mon Nov 29 11:05:55 1993 by Rik Faith .\" Modified Tue Oct 22 23:41:56 1996 by Eric S. Raymond .\" Modified 2002-07-17, aeb .\" 2008-01-24, mtk: .\" Various rewrites and additions (notes on longjmp() and SIGSEGV). .\" Weaken warning against use of alloca() (as per Debian bug 461100). .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH alloca 3 "20 lipca 2023 r." "Linux man\-pages 6.05.01" .SH NAZWA alloca \- przydzielanie pamięci, która jest automatycznie zwalniana .SH BIBLIOTEKA Standardowa biblioteka C (\fIlibc\fP, \fI\-lc\fP) .SH SKŁADNIA .nf \fB#include \fP .PP \fBvoid *alloca(size_t \fP\fIrozmiar\fP\fB);\fP .fi .SH OPIS Funkcja \fBalloca\fP() przydziela \fIrozmiar\fP 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 \fBalloca\fP() do miejsca wywołania. .SH "WARTOŚĆ ZWRACANA" Funkcja \fBalloca\fP() zwraca wskaźnik do początku przydzielonej pamięci. Gdy przydzielenie pamięci spowoduje przepełnienie stosu, zachowanie programu nie jest określone. .SH ATRYBUTY Informacje o pojęciach używanych w tym rozdziale można znaleźć w podręczniku \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Interfejs Atrybut Wartość T{ .na .nh \fBalloca\fP() T} Bezpieczeństwo wątkowe MT\-bezpieczne .TE .sp 1 .SH STANDARDY None. .SH HISTORIA PWB, 32V. .SH UWAGI The \fBalloca\fP() function is machine\- and compiler\-dependent. Because it allocates from the stack, it's faster than \fBmalloc\fP(3) and \fBfree\fP(3). In certain cases, it can also simplify memory deallocation in applications that use \fBlongjmp\fP(3) or \fBsiglongjmp\fP(3). Otherwise, its use is discouraged. .PP Ponieważ przestrzeń alokowana przez \fBalloca\fP() jest przydzielana z przestrzeni stosu, to przestrzeń ta jest automatycznie zwalniana, jeśli nastąpi przeskoczenie powrotu z funkcji przez wywołanie \fBlongjmp\fP(3) lub \fBsiglongjmp\fP(3). .PP The space allocated by \fBalloca\fP() is \fInot\fP automatically deallocated if the pointer that refers to it simply goes out of scope. .PP Pamięci przydzielonej przez \fBalloca\fP() nie można zwalniać za pomocą \fBfree\fP(3)! .PP By necessity, \fBalloca\fP() is a compiler built\-in, also known as \fB__builtin_alloca\fP(). By default, modern compilers automatically translate all uses of \fBalloca\fP() into the built\-in, but this is forbidden if standards conformance is requested (\fI\-ansi\fP, \fI\-std=c*\fP), in which case \fI\fP is required, lest a symbol dependency be emitted. .PP The fact that \fBalloca\fP() is a built\-in means it is impossible to take its address or to change its behavior by linking with a different library. .PP 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 \fBstrdupa\fP(3). .SH USTERKI 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 \fBSIGSEGV\fP signal if it attempts to access unavailable space.) .PP W wielu systemach \fBalloca\fP() nie może być używana w obrębie listy argumentów w wywołaniu funkcji, gdyż zarezerwowana przez \fBalloca\fP() przestrzeń stosu znalazłaby się w środku przestrzeni stosu przeznaczonej na argumenty funkcji. .SH "ZOBACZ TAKŻE" \fBbrk\fP(2), \fBlongjmp\fP(3), \fBmalloc\fP(3) .PP .SH TŁUMACZENIE Autorami polskiego tłumaczenia niniejszej strony podręcznika są: Adam Byrtek , Andrzej Krzysztofowicz , Robert Luberda i Michał Kułach . .PP Niniejsze tłumaczenie jest wolną dokumentacją. Bliższe informacje o warunkach licencji można uzyskać zapoznając się z .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License w wersji 3 .UE lub nowszej. Nie przyjmuje się ŻADNEJ ODPOWIEDZIALNOŚCI. .PP Błędy w tłumaczeniu strony podręcznika prosimy zgłaszać na adres listy dyskusyjnej .MT manpages-pl-list@lists.sourceforge.net .ME .