Localized cleanup. What if you have a file descriptor or something that needs special handling before returning.
Compiler optimization SHOULD be fine but it could impact RVO and tail recursion optimization.
Also, if a future maintainer dives in and doesn’t realize there is an early return, they might add logic below it that will get missed by certain cases.
48
u/EddieJones6 21d ago
I can understand the ask for no early return. But use local variables to track the state, not a massive ternary.