6 ms·
Why goto is bad? Again this "structured programming" bullshit. Kernel uses 2 a lot to handle errors like here [1]. [1] https://github.com/torvalds/linux/blob/m
by kia 14y ago
Why goto is bad? Again this "structured programming" bullshit. Kernel uses 2 a lot to handle errors like here [1].
[1] https://github.com/torvalds/linux/blob/master/mm/shmem.c#L990 https://github.com/torvalds/linux/blob/master/mm/shmem.c#L99...
- VolatileVoid 14y agoTHANK you. I was thinking the exact same thing. This is seen all over the kernel, and I found it to be a very readable, simple solution, and a very good use of goto.
- exDM69 14y agoIn general, gotos are bad. For error handling in C, they're perfect. Just don't jump backwards in code.
- dthunt 14y agoJumping backwards is fine, too. It's okay to ignore Dijkstra when he is wrong.
- evincarofautumn 14y agoHow dare you imply that programming could possibly be subtle or nuanced or require thought? The very idea that our entire field of expertise could not be adequately conveyed by an eight-page Microsoft Word document of absolute endorsements and prohibitions—laughable!
- Peaker 14y agoDijkstra justified his paper against gotos with reasoned statements that make a lot of sense. Unstructured goto's that do not form simple loops or skips are going to make the position in code a much more complicated notion. And the position in code is crucial to understanding the meaning of variables, for example.
- cube13 14y agoC already has a command to jump backwards in a loop. Continue.
- wildtype 14y agoJust because linux kernel use goto's doesn't mean that goto isn't bad. We need another argumentation.