4 ms·
> I'm not sure what your point is with `env_logger::init` That most of my programs have some global (i.e. "for the runtime of the program") stuff that is setup
by firebacon 8y ago
> I'm not sure what your point is with `env_logger::init`
That most of my programs have some global (i.e. "for the runtime of the program") stuff that is setup at the beginning of main. And that some of that might want to Drop when the program exits, for example to delete a temporary directory. Now, if I want to return a non-zero exit code I can not do so while still getting all this global stuff destructed correctly (or use a workaround like having a wrapper-main).
> Calling `std::process:exit(1)` at the end of main is identical to `return 1`.
The thing is that it is actually not the same with respect to destructors -- the documentation explicitly calls that out. See also the C++ comparison in my other comment.
- rabidferret 8y agoAh, I see. You're wanting to have destructors run on local variables assigned in `main`.