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

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.



> 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.




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

Search: