3 ms·
RAII only helps with 1 of 4 primary cases of safety. RAII deals (badly) with temporal safety, but not spacial safety (bounds errors etc), safe initialization (u
by adgjlsfhk1 2y ago
RAII only helps with 1 of 4 primary cases of safety. RAII deals (badly) with temporal safety, but not spacial safety (bounds errors etc), safe initialization (use before initialization), or undefined behavior (overflow/underflow, aliasing, etc).
- moralestapia 2y ago>RAII deals (badly) with temporal safety >safe initialization (use before initialization) These two are solved by proper use of RAII. But you have a point with UB. That's always been an issue, though, it's part of the idiosyncrasies of C/C++; all languages have their equivalent of UB.
- AnimalMuppet 2y agoHow does RAII not help with safe initialization? It's right in the name.
- badmintonbaseba 2y agoUse-after-free (or reference/iterator invalidation in general) is the main issue. RAII doesn't help there at all. RAII helps with deterministically cleaning up resources, which is important, but barely related to safety.