Espaços nominais
Variantes
Acções

atexit

Da cppreference.com
< c‎ | program

 
 
Utilitários de apoio do programa
Término do programa
Original:
Program termination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
Comunicando com o meio ambiente
Original:
Communicating with the environment
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sinais
Original:
Signals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipos de sinais
Original:
Signal types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Não-locais saltos
Original:
Non-local jumps
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido no cabeçalho <stdlib.h>
int atexit( void (*func)() );
Registra a função apontada pelo func a ser chamado ao término do programa normal (via exit() ou voltando de main()).
Original:
Registers the function pointed to by func to be called on normal program termination (via exit() or returning from main()).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Chamando a função de vários segmentos não induz uma corrida de dados. A implementação deverá apoiar o registro de funções, pelo menos, 32.
Original:
Calling the function from several threads does not induce a data race. The implementation shall support the registration of at least 32 functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

func -
ponteiro para uma função a ser chamada ao término do programa normal
Original:
pointer to a function to be called on normal program termination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

0 se o registro terá êxito valor diferente de zero, caso contrário.
Original:
0 if the registration succeeds, nonzero value otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exceções

noexcept specification:  
noexcept
  (desde C++11)

[editar] Exemplo

#include <stdlib.h>
#include <stdio.h>
 
void f1()
{
    puts("pushed first");
}
 
void f2()
{
    puts("pushed second");
}
 
int main()
{
    atexit(f1);
    atexit(f2);
}

Saída:

pushed second
pushed first

[editar] Veja também

registra uma função a ser chamada no momento da invocação quick_exit
Original:
registers a function to be called on quick_exit invocation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]