Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
関数:int atexit (void (*function) (void)) 同じ出口処理関数を複数回呼び出すことができます。終了ハンドラーを複数回呼び出すのはなぜですか? 同じ終了ハンドラーを複数回呼び出すことが理にかなっている例を教えてください。
int atexit (void (*function) (void))
診断を逆にします。関数atexitには、処理関数が既に登録されているかどうかを知る簡単な方法がないため、それを識別しようとさえしません。
atexit
そのため、それを禁止するものではありません。
しかし、同じハンドラーを複数回登録する実際のユーザーケースを見つけることができないことに同意します。