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

That error is not due to goto, it was just a goto which was errously executed because of badly formatted code. (It looked like the statement was inside an if-block due to the indent.)

Pyhon would have prevented this bug, but so would a formatter. Rust also requires braces for if-blocks to prevent this kind of error.



"The problem isn't C, it's that they weren't using C properly..."


But that is a legitimate problem.

Using a language feature that is a known footgun (`if ...` instead of `if {...}`) without being cautious enough to avoid shooting yourself in the foot is not the fault of the footgun, it's the fault of the programmer.

Additionally, in the above linked case, the problem isn't a misused `goto`, it's a misused `if ...`. It would be just as problematic if they typed `cleanup_context();` instead of `goto fail;`, but nobody complains about cleaning up state, do they?


Once a footgun shoots the feet of enough people, the problem is no longer with the people, it is with the thing that enables the footgun.


That's not really a fair complaint against C, when many safer languages whose syntax derives from C (e.g. javascript) would have the same problem.


It's a fair complaint against C and JavaScript.


And Java, C#, C++ etc. But whitespace-sensitive languages dot not have the issue.


It is not a problem specific to C. Any language where indents are independt of semantics is prone to this kind of bug.




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

Search: