Mercurial > hg > CbC > CbC_gcc
comparison 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 |
comparison
equal
deleted
inserted
replaced
41:c816ae4380d7 | 42:9e4f9e20b8f1 |
---|---|
1 #include<stdio.h> | |
2 #include<math.h> | |
3 | |
4 #define dprint(f, args...) \ | |
5 printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args) | |
6 | |
7 int | |
8 test(int a) | |
9 { | |
10 return (int)pow(a, 2.0); | |
11 } | |
12 | |
13 int | |
14 callee(double a, double b, double c, int d) | |
15 { | |
16 dprint("a=%d,b=%d,c=%d,d=%d\n", a,b,c,d); | |
17 return a+b+c+d; | |
18 } | |
19 | |
20 int | |
21 caller(int a, double b, double c, double d) | |
22 { | |
23 int x; | |
24 double y,z,w; | |
25 //x = test(a); | |
26 //y = test(b); | |
27 //z = test(c); | |
28 //w = test(d); | |
29 x=a, y=b; | |
30 z=c, w=d; | |
31 | |
32 return callee(y,z,w,x); | |
33 //return callee(b,c,d, a); | |
34 } | |
35 | |
36 int | |
37 main (int argc, char **argv) | |
38 { | |
39 int r; | |
40 r = caller(11,22,33,44); | |
41 //r = caller(11,22,33,44, 55,66,77,88); | |
42 printf("r = %d\n", r); | |
43 } | |
44 | |
45 | |
46 |