Mercurial > hg > CbC > CbC_gcc
view CbC-examples/test_func2code.c @ 22:0eb6cac880f0
add cbc example of quicksort.
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2009 17:15:58 +0900 |
parents | 959d4c8c8abc |
children |
line wrap: on
line source
#include<stdio.h> #include<stdlib.h> #define DEBUG 1 #ifdef DEBUG #define log(f, args...) \ fprintf(stderr, "in %s: "f, __FUNCTION__, ## args) #else #define log(f, args...) ; #endif __code exitter(int a) { exit(0); } __code cs0(int x, int y) { log("x = %d, y = %d.\n", x, y); log("will exit with code %d.\n", x*y); goto exitter(x*y); } void continuation(int a) { log("go code segment cs0\n"); goto cs0(a, a*20); log("Error: continuation reachs bad region.\n"); } int main(int argc, char **argv) { int a; if (argc>2) { a = atoi(argv[1]); } continuation(20); }