News for hackers. Stuff that matters.
Re:How can C Programs be so Reliable? (2008) by rrrrtttt on Friday December 06, 2013 @09:31AM (#6861154)
Exceptions are kind of like gotos, but worse, because the jump target is decided at runtime based on the state of the call stack and therefore cannot be determined just by looking at the code. So they're more like comefroms [0] than gotos.

[0] http://en.wikipedia.org/wiki/COMEFROM

Re:How can C Programs be so Reliable? (2008) by kazagistar on Friday December 06, 2013 @10:42AM (#6861578)
Right, which is why they are reserved for situations where you are not trying to "jump somewhere", but just want to give up and crash, because further execution in the current context has failed. If some external calling context really does not want to crash, the implementation of failing function doesn't and shouldn't care.
Re:How can C Programs be so Reliable? (2008) by zaphar on Friday December 06, 2013 @04:21PM (#6863874)
That might be what they are intended to be reserved for but the reality of what they get used for is much more of the "Jump Somewhere" sort.
Re:How can C Programs be so Reliable? (2008) by bashinator on Friday December 06, 2013 @07:07PM (#6864688)
Really? I had it drilled into me from day 3 or so, that "EXCEPTIONS ARE NOT FLOW CONTROL!"
Re:How can C Programs be so Reliable? (2008) by zaphar on Friday December 06, 2013 @11:52PM (#6865521)
After more than a decade of seeing exceptions in use it has become very apparent that no matter what they might have been told when they learned about exceptions most people use them for flow control. Mostly because they are a way of doing flow control.
Re:How can C Programs be so Reliable? (2008) by dragonwriter on Friday December 06, 2013 @07:24PM (#6864743)
> So they're more like comefroms than gotos.

Except, not, because the jump source for a particular exception handler is no more (and no less) determinable in advance than the jump target of an exception raised at a particular point. They are very much unlike either gotos or comefroms.

If you are going to criticize exceptions, do it directly, rather than by asserting that they are like something that they are completely unlike.