Mercurial > hg > CbC > CbC_examples
view test05.c @ 17:a4f44624a253
asm longjmp (can return correct address but return value is wrong)
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 24 Jan 2016 06:01:43 +0900 |
parents | 0d306982c8b9 |
children | 586096c45873 |
line wrap: on
line source
#include<stdio.h> #include<stdlib.h> #define dprint(f, args...) \ printf("in %s: "f, __FUNCTION__, ## args) void f01 (int a); void f02 (int a, float b); int main (); int g=0; void (*funcp)(int); __code (*csp)(int); __code caller(int a) { f01(a+2); f02(a+3, 13.2); funcp(a+4); goto csp(a+4); dprint("\n"); } __code end() { dprint("\n"); exit(0); } void f01(int a) { dprint("%d\n", a); g += a; return ; } void f02(int a, float b) { dprint("%d, %f\n", a, b); g -= a; g += b*0.3; return ; } __code cs01(int a) { dprint("%d\n", a); g += a; goto end() ; } __code cs02(int a, float b) { dprint("%d, %f\n", a, b); g -= a; g += b*0.3; goto end() ; } int main() { funcp = f01; csp = cs01; caller(10); }