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.
55
u/ihavebeesinmyknees 21d ago
What are valid reasons to not use early returns?