4 ms·
Any C++ programmer knows that bad things happen when throwing in a ctor. Just don't do it. This is a non problem.
by reallifecoder 9y ago
Any C++ programmer knows that bad things happen when throwing in a ctor. Just don't do it. This is a non problem.
- YSFEJ4SWJUVU6 9y agoNo. Just no.
- CamperBob2 9y agoThe RAII doctrine leaves you little choice, since the architects of C++ decided that constructors wouldn't be allowed to return NULL to indicate failure, or otherwise signal it in an easily-detectable manner. That's why I don't use RAII. It comes with a massive amount of baggage.
- johncolanduoni 9y agoYou can do RAII without constructors (e.g. Rust)
- CamperBob2 9y agoYep. There are any number of ways that C++ could have supported RAII without requiring either exceptions or a lot of unnecessary hacking, but they didn't.