3 ms·
The 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 oth
by CamperBob2 10y ago
The 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 10y agoYou can do RAII without constructors (e.g. Rust)
- CamperBob2 10y 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.