scopeguard

Does ScopeGuard use really lead to better code?

I came across this article written by Andrei Alexandrescu and Petru Marginean many years ago, which presents and discusses a utility class called ScopeGuard for writing exception-safe code. I'd like to know if coding with these objects truly leads to better code or if it obfuscates error handling, in that perhaps the guard's callback wou...

Dynamically created scope guards

I've read the article about scope guards (Generic: Change the Way You Write Exception-Safe Code — Forever) in DDJ and I understand their common use. However, the common use is to instantiate a particular stack guard on the stack for a particular operation, e.g.: { FILE* topSecret = fopen("cia.txt"); ON_BLOCK_EXIT(std::fclose, t...