Mercurial > hg > CbC > CbC_gcc
diff CbC-examples/parallel_check/c-int-double.c @ 42:9e4f9e20b8f1
add some examples.
author | kent@teto.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Mon, 25 Jan 2010 17:13:59 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CbC-examples/parallel_check/c-int-double.c Mon Jan 25 17:13:59 2010 +0900 @@ -0,0 +1,46 @@ +#include<stdio.h> +#include<math.h> + +#define dprint(f, args...) \ + printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args) + +int +test(int a) +{ + return (int)pow(a, 2.0); +} + +int +callee(double a, double b, double c, int d) +{ + dprint("a=%d,b=%d,c=%d,d=%d\n", a,b,c,d); + return a+b+c+d; +} + +int +caller(int a, double b, double c, double d) +{ + int x; + double y,z,w; + //x = test(a); + //y = test(b); + //z = test(c); + //w = test(d); + x=a, y=b; + z=c, w=d; + + return callee(y,z,w,x); + //return callee(b,c,d, a); +} + +int +main (int argc, char **argv) +{ + int r; + r = caller(11,22,33,44); + //r = caller(11,22,33,44, 55,66,77,88); + printf("r = %d\n", r); +} + + +