C Tutorial Setjmp/longjmp :sloppy exceptions
The C Language
C History
BCPL
Euclid’s Algorithm in C
Euclid on the PDP-11
Pieces of C
C Types
Declarators
Struct bit-fields
Code generated by bit fields
C Unions
Layout of Records and Unions
C Storage Classes
malloc() and free()
Dynamic Storage Allocation
Simple Dynamic Storage Allocation
malloc() and free() variants
Fragmentation
Fragmentation and Handles
Automatic Garbage Collection
Arrays
Lazy Logical Operators
The Switch Statement
setjmp/longjmp: Sloppy exceptions

Nondeterminism in C

 

 

HOME
 


 

#include <setjmp.h> 

jmp buf closure;  /* address, stack*/

void top(void) {

switch (setjmp(closure)) { 

case 0: child(); break; 

case 1: /* longjmp called */ break; 

}} 

void child() {child2(); } 

void child2() {longjmp(closure, 1); }

Contact for more learning: webmaster@freehost7com