SLAU132V October 2004 – February 2020
#include <stdlib.h>
jmp_buf context;
void function()
{
volatile int x = 3;
switch(setjmp(context))
{
case 0: setup(); break;
default:
{
/* We only reach here if longjmp occurs. Because x's lifetime begins before setjmp
and lasts through longjmp, the C standard requires x be declared "volatile". */
printf("x == %d\n", x);
break;
}
}
}