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

NOMBRE

       alloca - asigna memoria que se libera automáticamente

BIBLIOTECA

       Biblioteca Estándar C (libc, -lc)

SINOPSIS

       #include <alloca.h>

       void *alloca(size_t size);

DESCRIPCIÓN

       La  función  alloca()  concede size 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
       alloca() regresa a su invocador.

VALOR DEVUELTO

       La  función  alloca() 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.

ATRIBUTOS

       Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

       ┌────────────────────────────────────────────────┬────────────────────┬───────────────────┐
       │InterfazAtributoValor             │
       ├────────────────────────────────────────────────┼────────────────────┼───────────────────┤
       │alloca()                                        │ Seguridad del hilo │ Multi-hilo seguro │
       └────────────────────────────────────────────────┴────────────────────┴───────────────────┘

ESTÁNDARES

       Esta función no está definida en POSIX.1

       alloca() se origigó en PWB y 32V, figurando en todos sus derivados.

NOTAS

       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.

       Because the space allocated by alloca()  is allocated within the stack frame,  that  space
       is  automatically  freed if the function return is jumped over by a call to longjmp(3)  or
       siglongjmp(3).

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

       Do not attempt to free(3)  space allocated by alloca()!

       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.

       El hecho de que alloca() sea nativo, implica que es imposible tomar la dirección  de  esta
       función, o cambiar su comportamiento enlazándola con una biblioteca diferente.

       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).

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 SIGSEGV signal if it attempts to access unavailable space.)

       En muchos sistemas alloca() no puede ser utilizada dentro de la lista de argumentos de una
       llamada  a  función,  porque el espacio de pila reservado por alloca() aparecería en mitad
       del espacio de pila para los argumentos de la función.

VÉASE TAMBIÉN

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

TRADUCCIÓN

       La traducción al español de esta página del  manual  fue  creada  por  Sebastian  Desimone
       <chipy@argenet.com.ar>,  Gerardo  Aburruzaga  García  <gerardo.aburruzaga@uca.es>,  Miguel
       Pérez Ibars <mpi79470@alu.um.es> y Marcos Fouces <marcos@debian.org>

       Esta traducción es documentación libre; lea  la  GNU  General  Public  License  Version  3
       ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩  o posterior con respecto a las condiciones de
       copyright.  No existe NINGUNA RESPONSABILIDAD.

       Si encuentra algún error en la traducción de esta  página  del  manual,  envíe  un  correo
       electrónico a ⟨debian-l10n-spanish@lists.debian.org⟩.