4 ms·
I think having multiple exit points is good when the early exits are all at the beginning for trivial parameter validation, but likely to be bad if they're buri
by Khoth 7y ago
I think having multiple exit points is good when the early exits are all at the beginning for trivial parameter validation, but likely to be bad if they're buried in the middle of the function.
In either case, there's the disadvantage that if you want to do printf debugging and make the function print "function foo returned 'false'" when it returns, early return makes it a pain. (Generally not so much a problem for real cleanup work, since your early returns are likely before the function's actually done any work that needs cleanup)