If it returns after main() , then, in accordance with the standard, all destructors were started (although I would not have missed the implementation to wash it a bit), unless the atexit() function was used. This function registers a function that will be called after main() returns, efficiently (if I read 3.6.3). You can check if your program has atexit , if only for completeness.
Depending on what you mean by โafter major returnsโ, you can run destructors for static objects when the program crashes. Check them out. (Also post what you notice, making you think you might be wrong after returning main() .)
If not, then you called undefined behavior somewhere, it is very likely that you somehow damaged the stack. See Rup Answer for suggestions.
David thornley
source share