News for hackers. Stuff that matters.
Re:Emulating exceptions in C: a case study by stinos on Thursday August 27, 2015 @03:58AM (#10128125)
Yet whole applications are written around it and they work perfectly well. Not saying that is an argument that it is somehow a good idea, just that while it might looks bad, it also works ok when done properly.
Re:Emulating exceptions in C: a case study by humanrebar on Thursday August 27, 2015 @07:26AM (#10128741)
> it also works ok when done properly

That's circular reasoning. The objection is that it only works well in certain circumstances. Mostly in fairly simple applications with either small teams or rigid conventions to enforce clarity and prevent bugs.

Re:Emulating exceptions in C: a case study by tiagobraw on Thursday August 27, 2015 @09:22AM (#10129164)
Well, Lua coroutines uses longjmp and they're not "fairly simple" in any way.

I don't think it is a circular reasoning. There's always the good and the bad way to use something, even C++ exceptions.

Re:Emulating exceptions in C: a case study by humanrebar on Thursday August 27, 2015 @09:52AM (#10129341)
If "done properly" implies "works ok", then it's circular reasoning.

I'm not sure your example is a counterexample either. Implementing part of a fairly simple runtime (like Lua's) using longjmp is an example of a good use of longjmp, in my opinion.

Re:Emulating exceptions in C: a case study by anarazel on Thursday August 27, 2015 @11:06AM (#10129838)
I've seen longjmp used in a number of fairly large projects, with diverse teams. E.g. postgresql.

If abstracted away they don't necessarily cause that many problems. Sure, it'd be nicer if there were a better alternative, but often there's just none. And no C++ isn't always an alternative. Many older platforms have only horribly bad C++ compilers, certainly not ones where you want to rely on exception handling.