Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


I 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.


I'd go dummy function all the way.

No code duplication. No goto


well 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: