名前空間
変種
操作

atexit

提供: cppreference.com
< c‎ | program

 
 
プログラム支援ユーティリティ
プログラムの終了
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.
abort
exit
quick_exit(C++11)
_Exit(C++11)
環境と通信する
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.
信号
Original:
Signals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
信号タイプ
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.
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
非ローカルジャンプします
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.
setjmp
longjmp
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
jmp_buf
 
Defined in header <stdlib.h>
int atexit( void (*func)() );
プログラムの正常終了(func経由またはexit()から戻った)に呼ばれるように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.
複数のスレッドから関数を呼び出すと、データの競合を誘発しない。実装は少なくとも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.

目次

[編集] パラメータ

func -
通常のプログラムの終了時に呼び出される関数へのポインタです
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.

[編集] 値を返します

0そうでなければ、登録が成功した場合、ゼロ以外の値.
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.

[編集] 例外

noexcept specification:  
noexcept
  (C++11およびそれ以降)

[編集]

#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

[編集] も参照してください

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.

(関数) [edit]