4 ms·
you can still set a static flag or something in ctor then check it, but you can't do anything about dtor indeed if you need throw there.
by synergy20 5y ago
you can still set a static flag or something in ctor then check it, but you can't do anything about dtor indeed if you need throw there.
- Koshkin 5y agoExcept you are not supposed to throw in a destructor.
- synergy20 5y agohttps://www.cs.technion.ac.il/users/yechiel/c++-faq/dtors-shouldnt-throw.html https://www.cs.technion.ac.il/users/yechiel/c++-faq/dtors-sh... but what if dtor fails(e.g. can't release a resource), is the by-default action terminate or ignore?
- Koshkin 5y agoWell, the "environment" may decide for you in some cases, but there is no default action as such. You log an error and either terminate or ignore - depending on which causes less harm.