Mercurial > hg > CbC > old > device
view test/short.c @ 560:d6ff45d719a5 string-shared
string sharing
author | kono |
---|---|
date | Sat, 07 Jan 2006 18:11:53 +0900 |
parents | a379da780856 |
children |
line wrap: on
line source
int printf(const char *format, ...); short gj; short gi; short a[100]; unsigned short b[100]; unsigned char c[100]; short data[] = {10,20,-40,-50}; unsigned short udata[] = {10,20,-40,-50}; short f(short i,unsigned short j,unsigned short k,short m,short a); unsigned short g(short i,unsigned short j,unsigned short k,short m,short a); main() { int ii; short i,k,*p; unsigned short j,m,*up; unsigned char g0,h0; char g1,h1; unsigned short sg0,sh0; short sg1,sh1; unsigned char *pg0,*ph0; char *pg1,*ph1; unsigned short *psg0,*psh0; short *psg1,*psh1; i = -3; j = 3; k = 44; k = i*j+3+k; m = i*j-7+k; printf("#0036:%d %d %d\n",i,k,m); g0 = 123; g0++; --g0; ++g0; g0--; printf("#0041:g0=%d\n",g0); g1 = -123; g1++; --g1; ++g1; g1--; printf("#0045:g1=%d\n",g1); sg0 = 123; sg0++; --sg0; ++sg0; sg0--; printf("#0050:sg0=%d\n",sg0); sg1 = -123; sg1++; --sg1; ++sg1; sg1--; printf("#0054:sg1=%d\n",sg1); pg0 = &g0; ph0 = &h0; *pg0 = 123; //*pg0++; *--pg0; //*++pg0; *g0--; printf("#0061:g0=%d\n",*pg0); pg1 = &g1; ph1 = &h1; *pg1 = -123; //*pg1++; --*pg1; //++*pg1; *pg1--; printf("#0067:g1=%d\n",*pg1); psg0 = &sg0; psh0 = &sh0; *psg0 = 123; //*sg0++; *--sg0; //*++sg0; *sg0--; printf("#0074:sg0=%d\n",*psg0); psg1 = &sg1; psh1 = &sh1; *psg1 = -123; //*sg1++; *--sg1; //*++sg1; *sg1--; printf("#0080:sg1=%d\n",*psg1); h0 = g0 - 20; c[33] = g0; if (i==j) { printf("#0086:i==j\n"); } else { printf("#0086:i!=j\n"); } a[33] = i; b[33] = 105; printf("#0090:i=%d\n",i); printf("#0091:j=%d\n",j); i++; --i; j++; --j; printf("#0094:i=%d\n",i); printf("#0095:j=%d\n",j); gi = 3333; gj = 6666; gi++; --gi; gj++; --gj; printf("#0100:gi=%d\n",gi); printf("#0101:gj=%d\n",gj); printf("#0103:k=%d\n",k); printf("#0104:m=%d\n",m); printf("#0105:a[33]=%d\n",a[33]); printf("#0106:b[33]=%d\n",b[33]); printf("#0107:a[33]=%d\n",++a[33]); printf("#0108:b[33]=%d\n",b[33]--); printf("#0110:g0=%d\n",g0); printf("#0111:h0=%d\n",h0); printf("#0112:c[33]=%d\n",c[33]); p = data; printf("#0115:*p++ = %d\n",*p++); printf("#0116:*++p = %d\n",*++p); *p++ = -343; printf("#0118:*p-- = %d\n",*p--); printf("#0119:*--p = %d\n",*--p); up = udata; printf("#0121:*up-- = %d\n",*up--); printf("#0122:*--up = %d\n",*--up); *up++ = 65530; printf("#0124:*up-- = %d\n",*up--); printf("#0125:*--up = %d\n",*--up); ii = f(i,j,k,m,a[33]); printf("#0129:f()=%d\n",ii); ii = g(i,j,k,m,a[33]); printf("#0131:f()=%d\n",ii); return 0; } short f(short i,unsigned short j,unsigned short k,short m,short a) { return i+j*k-m/a; } unsigned short g(short i,unsigned short j,unsigned short k,short m,short a) { return i+j*k-m/a; }