Mercurial > hg > CbC > old > device
view test/inline.c @ 492:cc1a5f764782
*** empty log message ***
author | kono |
---|---|
date | Wed, 21 Dec 2005 12:10:43 +0900 |
parents | 2859bb9d5fb3 |
children | 3d921f7a8e74 |
line wrap: on
line source
const int a = 5,b = -3; int kkkk = 333; static const int as = 5,bs = -3; const char hoo[] = "test"; static const char haa[] = "test"; static inline const int f(int k); volatile const int i = 3; extern int printf(char *,...); int main0() { volatile const int j = 3; switch(i) { case 1: printf("#0015:1\n"); break; case 2: printf("#0016:2\n"); break; case 3: printf("#0017:3\n"); break; case 4: printf("#0018:4\n"); break; } switch(j) { case 1: printf("#0021:1\n"); break; case 2: printf("#0022:2\n"); break; case 3: printf("#0023:3\n"); break; case 4: printf("#0024:4\n"); break; } return 0; } extern int printf(char *,...); static inline const int f(int k) { return k+1; } inline int in1(int i,int j) { if (i>j) return j; else return i; } static inline int ins(int i,int j) { printf("#0046:%d %d\n",i,j); if (f(i)>j) return j; else return i; } static inline int ins1(int i,int j) { printf("#0054:%d %d\n",i,j); if (f(i)>j) return j; else return i; } inline __attribute__((always_inline)) int in2(int p,int i,int j) { int k = 0,m; do { k += 3; } while ( k < j); printf("#0065: %d do %d\n",p,k); while (k < j) { k -= 3; } while ( k < j); printf("#0070: %d while %d\n",p,k); m = 0; for(k=0;k<j;k++) { m += k; } printf("#0076: %d for %d\n",p,m); switch(i) { case 1: k = 1; break; case 2: k = 2; break; case 3: k = 3; break; case 4: k = 4; break; default: k = 5; } printf("#0089: %d switch %d\n",p,k); for(k=0;k<j;k++) { i += k; if (k<3) continue; } printf("#0095: %d for %d\n",p,i); goto hoge; hage: goto hage; hoge: return 0; } int (*fnp)(int i,int j); int (*fnp3)(int i,int j,int k); void a0(int k,int j) { int k1,j1; const int v=3,x=6; // a = 10; k1 = in1(a,b); printf("#0116:%d %d %d\n",a,b,k1); j1 = in1(k,j-6)+f(k1); printf("#0118:%d %d %s\n",k1,j1,hoo); k1 = &v-&x>0? &v-&x : &x-&v; printf("#0120:v-x: %d\n",k1); k1 = ins(a,b); j1 = ins(k,j-6)+f(k1); printf("#0124:%d %d %s\n",k1,j1,haa); k1 = ins(as,bs); j1 = ins(k,j-6)+f(k1); printf("#0128:%d %d %s\n",k1,j1,haa); k1 = ins(v,x); j1 = ins(k,j-6)+f(v); printf("#0132:%d %d %s\n",k1,j1,haa); k1 = fnp(v,x); j1 = ins1(k,j-6)+f(v); printf("#0136:%d %d %s\n",k1,j1,haa); } void a1(int k,int j) { in2(1,k,j); in2(2,3,10); in2(3,k,10); in2(4,2,j); in2(5,2,1); in2(6,0,2); in2(8,j*3,in2(7,k+3,10-j)); fnp3(9,0,2); } int main(int ac,char *av[]) { fnp = ins1; a0(5,6); a0(-9,6); fnp3 = in2; a1(9,10); main0(ac,av); return 0; }