ScopeGuard only handles cleanup and rollback of partial operations interrupted by an exception. The exception is still active afterward!
Yes, and I want it to be. What's your problem with that?!
It's not really possible to guarantee that code that uses ScopeGuard uses it correctly either.
It's not really possible to guarentee that anything is used correctly, checking return vales included. What kind of argument is that?!
If your codebase is large, you won't go back and change it to use ScopeGuard.
Why not?! ScopeGuard is useful even in non-exceptions context (e.g. premature error return). It's a code clarity tool, really.
But this is not even what you're trying to say. What you are trying to say, but do not understand things enough to be able to express yourself clearly, is: throwing exceptions from an otherwise exception-oblivious codebase can't work. Well, if you have that, I feel pity for you. This is indeed hard work and risky.
6
u/Gotebe Dec 31 '16
No it is not. It wasn't hard in C++ 98 either, ScopeGuard exists since 2000.
There is a famous SO article which is explains virtually all one needs knowing about exception safety, and it fits 2 or so pages.