...
Because assert()
calls abort()
, cleanup functions registered with atexit()
are not called. If the intention of the programmer is to properly clean up in the case of a failed assertion, then runtime assertions should be replaced with static assertions where possible (see DCL03-AC. Use a static assertion to test the value of a constant expression). When the assertion is based on runtime data, the assert
should be replaced with a runtime check that implements the adopted error strategy (see ERR00-A. Adopt and implement a consistent and comprehensive error handling policy).
...