3 ms·
One note on your point about changing return behaviour: That's the ONE case a goto is IMO warranted. If I have to choose between a dummy function, code duplicat
by DeepDuh 14y ago
One note on your point about changing return behaviour: That's the ONE case a goto is IMO warranted. If I have to choose between a dummy function, code duplication and a goto, I choose goto.
- andy_boot 14y agoI'd go dummy function all the way. No code duplication. No goto
- DeepDuh 14y agowell to each his own. In case of the cleanup phase before return I find it to be much cleaner with goto, since usually it's sub 10 lines and you'd have to program a function that gets pointers or objects passed that then get freed/destroyed, which I find ugly as hell. I look at such an outer procedure as an 'owner' of these objects and therefore I want to see the allocations and deallocations in plain text right there.
- edanm 14y agoI agree, but I didn't want to get bogged down in a "GOTO bad or not" discussion, which is why I left this detail out.