by KerrAvon · 2y ago · 0 comments
This is a pretty myopic view of things? There are lots of other things you might wish to do when the program terminates besides releasing resources...
This was actually my main reason for using C++ to program the control software: the fact that constructors and destructors run deterministically, especially when something bad happens and an exception is thrown. And while the language doesn't specify in which order they run for global variables in different compilation units, you still know how they are ordered with respect to `main()`, and if you pay attention to how the linker works, you can actually know how they will all be ordered.
Of course, I wouldn't put that clean up in an atexit.