Re:Defer Available in GCC and Clang
by uecker on Friday February 20, 2026 @04:08AM
(#47085519)
It is not clear to me that defer helps here. The issue is management of state (the return value) not control flow.
[ Parent
| on HN ]
Re:Defer Available in GCC and Clang
by dapperdrake on Friday February 20, 2026 @03:36PM
(#47093565)
The return value depends on control flow ("obvious", please bear with me):
With "goto" the cleanup-up can jump anywhere. With "defer" the cleanup cannot really jump anywhere. It is easier to mentally stick to simply cleaning up in a common sense way. And taking care of multiple "unrelated" clean-up steps is "handled for you."
(Attacks on this sometimes approach complaints about lack of "common sense".)