2 ms·
RAII is great until you stumble upon an API that is terrible and doesn't care. If you can't use exceptions or have any limitations that make RAII difficult to u
by xyzzy_plugh 10y ago
RAII is great until you stumble upon an API that is terrible and doesn't care. If you can't use exceptions or have any limitations that make RAII difficult to use, then suddenly everything becomes a lot messier.
Alternatively you can take it the other route and discard RAII but then you're basically just writing C.
Some of the most heinous, insane bugs I have ever seen are because C++ is a complexity nightmare and very intelligent people struggle to get things right. Rust is orders of magnitude safer as it forces you to play with safe constructs only (avoiding surprises left by others, or past you) and wrapping anything explicitly unsafe.