I'm been studying CERT C++ guidelines and I have a question related to ERR58-CPP. Handle all exceptions thrown before main()
begins executing.
I believe avoiding to use static/global variables is good for tonnes of reasons, and it is not make sense to throw exception before main()
. Even though, there are some cases that global variables which needs to be constructed before main()
and wrapping such classes to make their constructor never throw
is a good idea.
However, Scott Meyers said, one should never derive from std::string
. ( From Why should one not derive from c++ std string class? ) That is possibly due to slicing problems.
Is it okay to deriving from std::string
with no additional member variable/function and not overriding destructor?