...
Terminating a call to an atexit() registered handler in any way other than by returning results in undefined behavior , and may result in abnormal program termination or other unpredictable behavior. It may also prevent other registered handlers from being invoked.
...