annotate test/simp.c @ 618:a7f5796e540a

fix link error on undefined
author kono
date Wed, 06 Sep 2006 21:16:47 +0900
parents 2dee957ef988
children 5d3b4669854c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
618
a7f5796e540a fix link error on undefined
kono
parents: 615
diff changeset
1 // #include "stdio.h"
a7f5796e540a fix link error on undefined
kono
parents: 615
diff changeset
2 extern int printf(char *const,...);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
3
618
a7f5796e540a fix link error on undefined
kono
parents: 615
diff changeset
4 // #define UNDECL
541
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
5
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
6 float f = 3;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
7 float g = 4096.0f;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
8
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
9 int kk = {-3};
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
10
541
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
11 int
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
12 main2(int i)
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
13 {
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
14 i+=f;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
15 return +i;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
16 }
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
17
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
18 int
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
19 alpha(c)
d35df41eac69 Initial revision
kono
parents:
diff changeset
20 char c;
d35df41eac69 Initial revision
kono
parents:
diff changeset
21 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
22 return(('a'<=c&&c<='z')||('A'<=c&&c<='Z')||c=='_');
d35df41eac69 Initial revision
kono
parents:
diff changeset
23 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
24 char ch;
d35df41eac69 Initial revision
kono
parents:
diff changeset
25
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
26 void main1();
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
27 int main0() ;
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
28
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
29 int
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
30 main(int ac,char *av[])
d35df41eac69 Initial revision
kono
parents:
diff changeset
31 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
32 int i;
172
096559f07a70 some check
kono
parents: 0
diff changeset
33
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
34 printf("#0031:%d\n",ac);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
35 for(i=0;i<ac;i++) {
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
36 printf("#0033:%s\n",&av[i][3]);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
37 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
38 ch = 'E';
442
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
39 main1(-8);
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
40 printf("#0037:%d\n",main2(3));
615
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
41 #ifdef UNDECL
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
42 j = k; // undeclared global variable
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
43 printf("#0037:%d\n",h);
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
44 #endif
172
096559f07a70 some check
kono
parents: 0
diff changeset
45 return main0(ac,ch,av);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
46 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
47
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
48 int
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
49 main0(ac,ch,av)
d35df41eac69 Initial revision
kono
parents:
diff changeset
50 int ac;
d35df41eac69 Initial revision
kono
parents:
diff changeset
51 char ch;
d35df41eac69 Initial revision
kono
parents:
diff changeset
52 char *av[];
d35df41eac69 Initial revision
kono
parents:
diff changeset
53 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
54 int i;
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
55 printf("#0048:%d %c\n",ac,ch);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
56 for(i=0;i<ac;i++) {
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
57 printf("#0050:%s\n",&av[i][3]);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
58 }
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
59 printf("#0052:%d==1\n",alpha(ch));
172
096559f07a70 some check
kono
parents: 0
diff changeset
60 return 0;
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
61 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
62
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
63 void
442
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
64 main1(int l)
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
65 {
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
66 printf("#0059:%d\n", ((l+0)<-511||(l+0)>511));
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
67 if ((l+0)<-511||(l+0)>511) printf("#0060:yes\n");
442
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
68 l = -1;
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
69 printf("#0062:%d\n", l==-1? 555:333);
442
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
70 }
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
71
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
72