Ticket #1380: x.c

File x.c, 317 bytes (added by felix winkelmann, 7 years ago)

simple test program using setjmp/alloca in the manner used in CHICKEN_run

Line 
1#include <stdio.h>
2#include <alloca.h>
3#include <setjmp.h>
4#include <string.h>
5#include <stdlib.h>
6
7
8jmp_buf jb;
9
10
11int foo = 99;
12int c = 0;
13
14
15void bar()
16{
17  c++;
18  longjmp(jb, 1);
19}
20
21
22int main()
23{
24  setjmp(jb);
25  char *p = alloca(256);
26  memset(p, 0, 256);
27  printf("%d\n", foo);
28 
29  if(c < 10) bar();
30
31  exit(0);
32}