News for hackers. Stuff that matters.
Re:Nine ways to break your systems code using volatile by kazinator on Friday October 06, 2023 @11:27AM (#37792075)
setjmp isn't a function so it's not comparable.

Here's a better analogy. The equivalent just works if we use C++ exception handling instead of setjmp. You can change variables after a try, and those values will be reliably observed in the catch.

setjmp and longjmp are a module that you can write in a small amount of assembly language, without changing anything in the compiler to support them. (Provided it has a bona fide volatile.)

Exception handling is a fairly complex feature requiring supporting in the compiler, with various strategies that have different performance trade-offs.

Re:Nine ways to break your systems code using volatile by gpderetta on Monday October 09, 2023 @06:08AM (#37818779)
> Here's a better analogy. The equivalent just works if we use C++ exception handling instead of setjmp. You can change variables after a try, and those values will be reliably observed in the catch

That's a very nice comparison.