Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

excellent setjmp/longjmp tutorials [closed]

Tags:

c

setjmp

Hi I'd like to read good tutorials on setjmp/longjmp in C. It'd be better if there're examples which are real rather than artificial.

Thanks.

like image 417
Nyan Avatar asked Nov 14 '09 08:11

Nyan


2 Answers

It's not really a tutorial as such, but the libpng documentation describes how the library uses setjmp/longjmp to do error handling.

like image 132
Greg Hewgill Avatar answered Oct 11 '22 12:10

Greg Hewgill


The book "C interfaces and implementation" explains the concept well and implements a usable "exception" simulation in C using these constructs. The code for it (chapter 4) is freely available online here.

Edit: also see this SO thread

like image 27
Eli Bendersky Avatar answered Oct 11 '22 14:10

Eli Bendersky