.\" -*- 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 "15 Diciembre 2022" "Páginas de manual de Linux 6.03" .SH NOMBRE alloca \- asigna memoria que se libera automáticamente .SH BIBLIOTECA Biblioteca Estándar C (\fIlibc\fP, \fI\-lc\fP) .SH SINOPSIS .nf \fB#include \fP .PP \fBvoid *alloca(size_t \fP\fIsize\fP\fB);\fP .fi .SH DESCRIPCIÓN La función \fBalloca\fP() concede \fIsize\fP bytes de espacio en el marco de pila (stack frame) del invocador. Este espacio temporal se libera automáticamente cuando la función que llamó a \fBalloca\fP() regresa a su invocador. .SH "VALOR DEVUELTO" La función \fBalloca\fP() devuelve un puntero al comienzo del espacio concedido. Si la reserva provoca un desbordamiento de pila, el comportamiento del programa es indefinido. Esta función no se encuentra en POSIX ni SUSv3. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .ad l .nh .TS allbox; lbx lb lb l l l. Interfaz Atributo Valor T{ \fBalloca\fP() T} Seguridad del hilo Multi\-hilo seguro .TE .hy .ad .sp 1 .SH ESTÁNDARES Esta función no está definida en POSIX.1 .PP \fBalloca\fP() se origigó en PWB y 32V, figurando en todos sus derivados. .SH NOTAS 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 Because the space allocated by \fBalloca\fP() is allocated within the stack frame, that space is automatically freed if the function return is jumped over by a call to \fBlongjmp\fP(3) or \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 Do not attempt to \fBfree\fP(3) space allocated by \fBalloca\fP()! .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 El hecho de que \fBalloca\fP() sea nativo, implica que es imposible tomar la dirección de esta función, o cambiar su comportamiento enlazándola con una biblioteca diferente. .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 ERRORES 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 En muchos sistemas \fBalloca\fP() no puede ser utilizada dentro de la lista de argumentos de una llamada a función, porque el espacio de pila reservado por \fBalloca\fP() aparecería en mitad del espacio de pila para los argumentos de la función. .SH "VÉASE TAMBIÉN" \fBbrk\fP(2), \fBlongjmp\fP(3), \fBmalloc\fP(3) .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Sebastian Desimone , Gerardo Aburruzaga García , Miguel Pérez Ibars y Marcos Fouces . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .