3 ms·
RAII is not superior both ways have their own drawbacks. You can forget to write finally and it may produce duplicated code. On the other hand RAII requires you
by oselhn 10y ago
RAII is not superior both ways have their own drawbacks. You can forget to write finally and it may produce duplicated code. On the other hand RAII requires you to create new type just for exception safety (scope guard - which you may also forget to use). I prefer RAII but there are situations where finally leads to more readable code.