Yenya's World

Tue, 20 Oct 2009


When teaching, the questions from the audience provide an important feedback to me - a notion of whether I was successful in passing the information to the audience, and what to improve or explain in a different way. There are, however, rare occasions when the question just makes me think "WTF?".

Yesterday I tried to explain the setjmp(3)/longjmp(3) semantics. These two functions are not straightforward, and it probably takes a while to wrap one's mind around them. But after that, the usage is quite simple: the target of the non-local jump is firstly initialized using setjmp(3), and later the jump itself can be made using longjmp(3). I have written the following code snipplet to demonstrate it:

setjmp/longjmp example

During the lecture when I asked whether there were any questions, the question was: "But is there any framework for those functions?". I was totally puzzled: I probably don't know all the meanings of the English word "framework", but I think it means something like a higher-level abstraction or environment to wrap the lower-level things in order to make them simpler to use (often at a cost of freedom of how to do things). But can this fancy goto be made even simpler than it is? It would still be necessary to declare the label somehow (setjmp(3)) and then jump to it (longjmp(3)). WTF? What framework?

Section: /computers (RSS feed) | Permanent link | 5 writebacks


Yenya's World: Linux and beyond - Yenya's blog.


RSS feed

Jan "Yenya" Kasprzak

The main page of this blog



Blog roll:

alphabetically :-)