atexit
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>| Elemento definito nell'header <stdlib.h>
|
||
int atexit( void (*func)() ); |
||
Registra la funzione puntata da
func di essere chiamato al termine del programma normale (tramite exit() o di ritorno da 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.
You can help to correct and verify the translation. Click here for instructions.
Chiamare la funzione da più thread non induce una gara di dati. L'applicazione deve supportare la registrazione di almeno funzioni
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.
You can help to correct and verify the translation. Click here for instructions.
Parametri
| func | - | puntatore a una funzione da chiamare in caso di cessazione del programma normale
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. |
Valore di ritorno
0 se la registrazione ha esito positivo, il valore diverso da zero in caso contrario.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.
You can help to correct and verify the translation. Click here for instructions.
Eccezioni
Esempio
#include <stdlib.h>
#include <stdio.h>
void f1()
{
puts("pushed first");
}
void f2()
{
puts("pushed second");
}
int main()
{
atexit(f1);
atexit(f2);
}
Output:
pushed second
pushed first
Vedi anche
(C99) |
registra una funzione di essere chiamato invocazione 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. (funzione) |
C++ documentation for atexit
| |