Re:Implementing Go's defer keyword in C++
by karmakaze on Saturday October 21, 2017 @05:42PM
(#15523765)
> con: "finally" puts the cleanup code at the end of the function. With "defer" you have it scattered at the beginning.
I would consider this a 'pro' as each action and defer are paired, executes in reverse order and a conditional action/defer doesn't need a second matching check.
I would consider this a 'pro' as each action and defer are paired, executes in reverse order and a conditional action/defer doesn't need a second matching check.