During normal program termination, any registered callbacks using std::atexit are executed as part of the cleanup. The callbacks follow the initialization and destruction rules from C++11. For example, if a construction of a static object was ordered before a callback is registered, the destruction of that object will be sequenced after the callback is invoked. Compiler Explorer link: https://lnkd.in/eihDRvg6 #cpp #cplusplus #coding #programming #dailybiteofcpp
Tidbit: automatic object destruction is in reverse order of construction.
when C++ is going to implement defer.... I really like Zig defer implementation and Enum Union
Well I never! 👍🏻
Synechron•775 followers
2yWhat's the actual use of this? Cleanup is being carried out at the time of destructor call . If we need any cleanup before destructor call then we can write a simple method and do cleanup in that .