News for hackers. Stuff that matters.
Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by girvo on Saturday October 05, 2019 @09:14PM (#21169147)
And goto being used for error handling is pretty stock standard across most C codebases I’ve worked on or seen over the years, so I’m not sure what the particular gripe is there
Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by telanis on Saturday October 05, 2019 @09:26PM (#21169205)
Since when is "we do it all the time" the same as "it's a good thing"?
Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by nothrabannosir on Saturday October 05, 2019 @10:20PM (#21169404)
goto for error handling is not just "freeform anything goes goto". It's a very specific idiom, being an "error" label and a bunch of "if (resource) free(resource)" statements at the end of the function. It is essentially analogous to a common use case of Go's defer. Typically an accepted pattern when dealing with many resources and possible exit points. Prevalent in I/O heavy code.

Different ballgame from the subject of Dijkstra's manifesto.

Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by josteink on Sunday October 06, 2019 @05:25AM (#21170841)
> It is essentially analogous to a common use case of Go

Go, which is also known for its terrible error-handling.

Great.

Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by neop1x on Monday October 07, 2019 @05:26AM (#21178895)
Really? I have never seen a Go program to misbehave while not printing some meaningful output. It is possible but almost no one ignores the error parameter. Yet I have seen many, many Java and Python software which quit after the first Unhandled Exception. So often that I consider exceptions as the bad error handling mechanism.
Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by cjbprime on Saturday October 05, 2019 @11:39PM (#21169682)
It's both common and a good idea, when used purely internally to a function in order to redirect error paths to a standard set of cleanup code. It helps prevents memory errors and other problems.

This is the sense in which the Linux kernel uses goto.

Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by tmd83 on Saturday October 05, 2019 @11:45PM (#21169701)
I'm not experienced in C or kernel code but from my understanding they use it almost entirely like a catch/finally clause of many higher level language which is a widely accepted and successful pattern.
Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by kevin_thibedeau on Saturday October 05, 2019 @10:59PM (#21169534)
Properly used goto is essentially an inline exception handler. That is a good thing to eliminate repetitive fault checks and fragile cleanup code.
Re:Google, Xiaomi, and Huawei affected by zero-day flaw that... by __s on Saturday October 05, 2019 @09:47PM (#21169294)
Since when are standard practices the same as "it's a good thing"?

Well written code is the best code. Some well written code uses goto. Some not well written code doesn't use goto