I want to know if functions registered with atexit() are called before or after global variables are destroyed. Is this specified by the standard or implementation defined?
I want to know if functions registered with atexit() are called before or after
Share
It is well-defined, and depends on whether the object in question was constructed before or after the function got registered using
atexit():My layman’s interpretation of the above is that stuff that got constructed before you called
atexit(handler)gets destroyed afterhandler()is called, and vice versa. I am sure there are subtleties, but this seems to be the basic principle.