Hacker News new | ask | show | jobs
by lwb 2318 days ago
The point this article makes most clear is exactly to what extent C++ has the attitude of “screw it, let’s put it in”. There are only a handful of constructs listed that C++ doesn’t implement.

Also, TIL about “long jump”. Seems like a feature I’d never use in a million years, but maybe it has its applications.

1 comments

LongJmp can be used as a way to implement exceptions at a low level, especially in languages like C, where you dont have them as a language construct.

You call SetJmp, where you would want to put your try/catch blocks, then no matter how deep down some call stack you go, if an errir occurs, you can immediately jump back to where you called setjmp and handle it / report the error or whatever, rather than having to handle and bubble up the error by at every intermediate level, "returning" your way up the call stack.