3 ms·
I do this and sometimes also something else: A local enum as a return value, where you have to compare the enum to use its value (ie you can't just 0/1 it).
by fifticon 4y ago
I do this and sometimes also something else:
A local enum as a return value, where you have to compare the enum to use its value (ie you can't just 0/1 it).
I of course don't always do this.
I do it, when the semantics of the function value is a bit tricky. It is to protect against bugs "oh i'm pretty sure I know what returning true/false here means.
It both helps the caller, as well as the implementation.
when you are writing the return statements for edge cases, it can be a help that you return not just 'true', but IREALLYINSISTTHISMEANTWECOULDPARSEITANDCONTINUE.
Again, I don't do this for simple obvious code.