annotate test/short.c @ 172:096559f07a70

some check
author kono
date Tue, 25 Nov 2003 11:47:41 +0900
parents 6e0f67b7d200
children 5b50813d0c45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
170
6e0f67b7d200 test files
kono
parents:
diff changeset
1
6e0f67b7d200 test files
kono
parents:
diff changeset
2 short gj;
6e0f67b7d200 test files
kono
parents:
diff changeset
3 short gi;
6e0f67b7d200 test files
kono
parents:
diff changeset
4
6e0f67b7d200 test files
kono
parents:
diff changeset
5 short a[100];
6e0f67b7d200 test files
kono
parents:
diff changeset
6 unsigned short b[100];
6e0f67b7d200 test files
kono
parents:
diff changeset
7 unsigned char c[100];
6e0f67b7d200 test files
kono
parents:
diff changeset
8
6e0f67b7d200 test files
kono
parents:
diff changeset
9 short data[] = {10,20,-40};
6e0f67b7d200 test files
kono
parents:
diff changeset
10 unsigned short udata[] = {10,20,-40};
6e0f67b7d200 test files
kono
parents:
diff changeset
11
6e0f67b7d200 test files
kono
parents:
diff changeset
12 short f(short i,unsigned short j,unsigned short k,short m,short a);
6e0f67b7d200 test files
kono
parents:
diff changeset
13 unsigned
6e0f67b7d200 test files
kono
parents:
diff changeset
14 short g(short i,unsigned short j,unsigned short k,short m,short a);
6e0f67b7d200 test files
kono
parents:
diff changeset
15
6e0f67b7d200 test files
kono
parents:
diff changeset
16 main()
6e0f67b7d200 test files
kono
parents:
diff changeset
17 {
6e0f67b7d200 test files
kono
parents:
diff changeset
18 int ii;
6e0f67b7d200 test files
kono
parents:
diff changeset
19 short i,k,*p;
6e0f67b7d200 test files
kono
parents:
diff changeset
20 unsigned short j,m,*up;
6e0f67b7d200 test files
kono
parents:
diff changeset
21 unsigned char g0,h0;
6e0f67b7d200 test files
kono
parents:
diff changeset
22 char g1,h1;
6e0f67b7d200 test files
kono
parents:
diff changeset
23 unsigned short sg0,sh0;
6e0f67b7d200 test files
kono
parents:
diff changeset
24 short sg1,sh1;
6e0f67b7d200 test files
kono
parents:
diff changeset
25 unsigned char *pg0,*ph0;
6e0f67b7d200 test files
kono
parents:
diff changeset
26 char *pg1,*ph1;
6e0f67b7d200 test files
kono
parents:
diff changeset
27 unsigned short *psg0,*psh0;
6e0f67b7d200 test files
kono
parents:
diff changeset
28 short *psg1,*psh1;
6e0f67b7d200 test files
kono
parents:
diff changeset
29
6e0f67b7d200 test files
kono
parents:
diff changeset
30
6e0f67b7d200 test files
kono
parents:
diff changeset
31 i = -3;
6e0f67b7d200 test files
kono
parents:
diff changeset
32 j = 3;
6e0f67b7d200 test files
kono
parents:
diff changeset
33 k = 44;
6e0f67b7d200 test files
kono
parents:
diff changeset
34 k = i*j+3+k;
6e0f67b7d200 test files
kono
parents:
diff changeset
35 m = i*j-7+k;
6e0f67b7d200 test files
kono
parents:
diff changeset
36 printf("%d %d %d\n",i,k,m);
6e0f67b7d200 test files
kono
parents:
diff changeset
37
6e0f67b7d200 test files
kono
parents:
diff changeset
38 g0 = 123;
6e0f67b7d200 test files
kono
parents:
diff changeset
39 g0++; --g0;
6e0f67b7d200 test files
kono
parents:
diff changeset
40 ++g0; g0--;
6e0f67b7d200 test files
kono
parents:
diff changeset
41 printf("g0=%d\n",g0);
6e0f67b7d200 test files
kono
parents:
diff changeset
42 g1 = -123;
6e0f67b7d200 test files
kono
parents:
diff changeset
43 g1++; --g1;
6e0f67b7d200 test files
kono
parents:
diff changeset
44 ++g1; g1--;
6e0f67b7d200 test files
kono
parents:
diff changeset
45 printf("g1=%d\n",g1);
6e0f67b7d200 test files
kono
parents:
diff changeset
46
6e0f67b7d200 test files
kono
parents:
diff changeset
47 sg0 = 123;
6e0f67b7d200 test files
kono
parents:
diff changeset
48 sg0++; --sg0;
6e0f67b7d200 test files
kono
parents:
diff changeset
49 ++sg0; sg0--;
6e0f67b7d200 test files
kono
parents:
diff changeset
50 printf("sg0=%d\n",sg0);
6e0f67b7d200 test files
kono
parents:
diff changeset
51 sg1 = -123;
6e0f67b7d200 test files
kono
parents:
diff changeset
52 sg1++; --sg1;
6e0f67b7d200 test files
kono
parents:
diff changeset
53 ++sg1; sg1--;
6e0f67b7d200 test files
kono
parents:
diff changeset
54 printf("sg1=%d\n",sg1);
6e0f67b7d200 test files
kono
parents:
diff changeset
55
6e0f67b7d200 test files
kono
parents:
diff changeset
56 pg0 = &g0;
6e0f67b7d200 test files
kono
parents:
diff changeset
57 ph0 = &h0;
6e0f67b7d200 test files
kono
parents:
diff changeset
58 *pg0 = 123;
6e0f67b7d200 test files
kono
parents:
diff changeset
59 //*pg0++; *--pg0;
6e0f67b7d200 test files
kono
parents:
diff changeset
60 //*++pg0; *g0--;
6e0f67b7d200 test files
kono
parents:
diff changeset
61 printf("g0=%d\n",*pg0);
6e0f67b7d200 test files
kono
parents:
diff changeset
62 pg1 = &g1;
6e0f67b7d200 test files
kono
parents:
diff changeset
63 ph1 = &h1;
6e0f67b7d200 test files
kono
parents:
diff changeset
64 *pg1 = -123;
6e0f67b7d200 test files
kono
parents:
diff changeset
65 //*pg1++; --*pg1;
6e0f67b7d200 test files
kono
parents:
diff changeset
66 //++*pg1; *pg1--;
6e0f67b7d200 test files
kono
parents:
diff changeset
67 printf("g1=%d\n",*pg1);
6e0f67b7d200 test files
kono
parents:
diff changeset
68
6e0f67b7d200 test files
kono
parents:
diff changeset
69 psg0 = &sg0;
6e0f67b7d200 test files
kono
parents:
diff changeset
70 psh0 = &sh0;
6e0f67b7d200 test files
kono
parents:
diff changeset
71 *psg0 = 123;
6e0f67b7d200 test files
kono
parents:
diff changeset
72 //*sg0++; *--sg0;
6e0f67b7d200 test files
kono
parents:
diff changeset
73 //*++sg0; *sg0--;
6e0f67b7d200 test files
kono
parents:
diff changeset
74 printf("sg0=%d\n",*psg0);
6e0f67b7d200 test files
kono
parents:
diff changeset
75 psg1 = &sg1;
6e0f67b7d200 test files
kono
parents:
diff changeset
76 psh1 = &sh1;
6e0f67b7d200 test files
kono
parents:
diff changeset
77 *psg1 = -123;
6e0f67b7d200 test files
kono
parents:
diff changeset
78 //*sg1++; *--sg1;
6e0f67b7d200 test files
kono
parents:
diff changeset
79 //*++sg1; *sg1--;
6e0f67b7d200 test files
kono
parents:
diff changeset
80 printf("sg1=%d\n",*psg1);
6e0f67b7d200 test files
kono
parents:
diff changeset
81
6e0f67b7d200 test files
kono
parents:
diff changeset
82
6e0f67b7d200 test files
kono
parents:
diff changeset
83 h0 = g0 - 20;
6e0f67b7d200 test files
kono
parents:
diff changeset
84 c[33] = g0;
6e0f67b7d200 test files
kono
parents:
diff changeset
85
6e0f67b7d200 test files
kono
parents:
diff changeset
86 if (i==j) { printf("i==j\n"); } else { printf("i!=j\n"); }
6e0f67b7d200 test files
kono
parents:
diff changeset
87
6e0f67b7d200 test files
kono
parents:
diff changeset
88 a[33] = i;
6e0f67b7d200 test files
kono
parents:
diff changeset
89 b[33] = 105;
6e0f67b7d200 test files
kono
parents:
diff changeset
90 printf("i=%d\n",i);
6e0f67b7d200 test files
kono
parents:
diff changeset
91 printf("j=%d\n",j);
6e0f67b7d200 test files
kono
parents:
diff changeset
92 i++; --i;
6e0f67b7d200 test files
kono
parents:
diff changeset
93 j++; --j;
6e0f67b7d200 test files
kono
parents:
diff changeset
94 printf("i=%d\n",i);
6e0f67b7d200 test files
kono
parents:
diff changeset
95 printf("j=%d\n",j);
6e0f67b7d200 test files
kono
parents:
diff changeset
96 gi = 3333;
6e0f67b7d200 test files
kono
parents:
diff changeset
97 gj = 6666;
6e0f67b7d200 test files
kono
parents:
diff changeset
98 gi++; --gi;
6e0f67b7d200 test files
kono
parents:
diff changeset
99 gj++; --gj;
6e0f67b7d200 test files
kono
parents:
diff changeset
100 printf("gi=%d\n",gi);
6e0f67b7d200 test files
kono
parents:
diff changeset
101 printf("gj=%d\n",gj);
6e0f67b7d200 test files
kono
parents:
diff changeset
102
6e0f67b7d200 test files
kono
parents:
diff changeset
103 printf("k=%d\n",k);
6e0f67b7d200 test files
kono
parents:
diff changeset
104 printf("m=%d\n",m);
6e0f67b7d200 test files
kono
parents:
diff changeset
105 printf("a[33]=%d\n",a[33]);
6e0f67b7d200 test files
kono
parents:
diff changeset
106 printf("b[33]=%d\n",b[33]);
6e0f67b7d200 test files
kono
parents:
diff changeset
107 printf("a[33]=%d\n",++a[33]);
6e0f67b7d200 test files
kono
parents:
diff changeset
108 printf("b[33]=%d\n",b[33]--);
6e0f67b7d200 test files
kono
parents:
diff changeset
109
6e0f67b7d200 test files
kono
parents:
diff changeset
110 printf("g0=%d\n",g0);
6e0f67b7d200 test files
kono
parents:
diff changeset
111 printf("h0=%d\n",h0);
6e0f67b7d200 test files
kono
parents:
diff changeset
112 printf("c[33]=%d\n",c[33]);
6e0f67b7d200 test files
kono
parents:
diff changeset
113
6e0f67b7d200 test files
kono
parents:
diff changeset
114 p = data;
6e0f67b7d200 test files
kono
parents:
diff changeset
115 printf("*p++ = %d\n",*p++);
6e0f67b7d200 test files
kono
parents:
diff changeset
116 printf("*++p = %d\n",*++p);
6e0f67b7d200 test files
kono
parents:
diff changeset
117 *p++ = -343;
6e0f67b7d200 test files
kono
parents:
diff changeset
118 printf("*p-- = %d\n",*p--);
6e0f67b7d200 test files
kono
parents:
diff changeset
119 printf("*--p = %d\n",*--p);
6e0f67b7d200 test files
kono
parents:
diff changeset
120 up = udata;
6e0f67b7d200 test files
kono
parents:
diff changeset
121 printf("*up-- = %d\n",*up--);
6e0f67b7d200 test files
kono
parents:
diff changeset
122 printf("*--up = %d\n",*--up);
6e0f67b7d200 test files
kono
parents:
diff changeset
123 *up++ = 65530;
6e0f67b7d200 test files
kono
parents:
diff changeset
124 printf("*up-- = %d\n",*up--);
6e0f67b7d200 test files
kono
parents:
diff changeset
125 printf("*--up = %d\n",*--up);
6e0f67b7d200 test files
kono
parents:
diff changeset
126
6e0f67b7d200 test files
kono
parents:
diff changeset
127
6e0f67b7d200 test files
kono
parents:
diff changeset
128 ii = f(i,j,k,m,a[33]);
6e0f67b7d200 test files
kono
parents:
diff changeset
129 printf("f()=%d\n",ii);
6e0f67b7d200 test files
kono
parents:
diff changeset
130 ii = g(i,j,k,m,a[33]);
6e0f67b7d200 test files
kono
parents:
diff changeset
131 printf("f()=%d\n",ii);
172
096559f07a70 some check
kono
parents: 170
diff changeset
132 return 0;
170
6e0f67b7d200 test files
kono
parents:
diff changeset
133 }
6e0f67b7d200 test files
kono
parents:
diff changeset
134
6e0f67b7d200 test files
kono
parents:
diff changeset
135 short f(short i,unsigned short j,unsigned short k,short m,short a)
6e0f67b7d200 test files
kono
parents:
diff changeset
136 {
6e0f67b7d200 test files
kono
parents:
diff changeset
137 return i+j*k-m/a;
6e0f67b7d200 test files
kono
parents:
diff changeset
138 }
6e0f67b7d200 test files
kono
parents:
diff changeset
139
6e0f67b7d200 test files
kono
parents:
diff changeset
140 unsigned
6e0f67b7d200 test files
kono
parents:
diff changeset
141 short g(short i,unsigned short j,unsigned short k,short m,short a)
6e0f67b7d200 test files
kono
parents:
diff changeset
142 {
6e0f67b7d200 test files
kono
parents:
diff changeset
143 return i+j*k-m/a;
6e0f67b7d200 test files
kono
parents:
diff changeset
144 }