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

I had points taken off from a C programming assignment in college once because I used goto for cleanup, and the grader blindly took off points for using goto. It took me quite a few back & forths with him to convince him that my usage was fine. His words were: "the use of goto is rather dangerous and usually leads to spaghetti code and reduction in performance (because of prediction + cache reasons), wherever you used goto you could've used functions".


I have heard about this happening to others. In the kernel I developed as part of an operating systems course, I pre-emptively commented my use of goto with a short justification of its usage and cited its use in the linux kernel. I didn't get any response, so I have no idea how the T.A. felt about it. I didn't lose any points, at least.


> wherever you used goto you could've used functions

Ah, if only C would guarantee tail call optimization >:)




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

Search: