annotate test/strinit.c @ 542:492f06738550

working... (struct init fix)
author kono
date Sun, 01 Jan 2006 18:49:07 +0900
parents a379da780856
children 9defd9459016
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
32737bad7489 fix list/tag interference
kono
parents: 448
diff changeset
1 #include <stdio.h>
448
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
2
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
3 int b[3] = {1,2,3};
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
4
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
5 struct temp {
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
6 int a;
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
7 int b;
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
8 int c;
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
9 int d;
542
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
10 struct hoge {
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
11 int k;
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
12 int j;
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
13 } m;
448
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
14 int e;
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
15 } temp1 = {
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
16 // 101,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
17 // 102,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
18 // 103,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
19 // 104,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
20 // 105,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
21 .e = 5,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
22 .a = 3
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
23 };
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
24
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
25 struct temp temp3 = {
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
26 .c = (int)&b,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
27 .d = -10,
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
28 .a = (int)b
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
29 };
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
30
542
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
31 struct temp temp4 = { 1,2,3,4,5,6,7};
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
32 struct temp temp7 = { 1,2,3,4,{5,6},7};
448
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
33
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
34
542
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
35 int
448
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
36 main()
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
37 {
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
38 struct temp temp2 = { .c = 5, .e=99 };
542
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
39 #ifdef WRONG
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
40 struct temp temp5 = { 1,2,3,4,5,6,7,8};
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
41 struct temp temp6 = { 1,2,3,4,5,6};
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
42 #else
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
43 struct temp temp5 = { 1,2,3,4,5,6,7};
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
44 struct temp temp6 = { 1,2,3,4,5,6,7};
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
45 struct temp temp8 = { 1,2,3,4,{5,6},7};
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
46 #endif
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
47 printf("#0042:1: %d\n",temp1.a);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
48 printf("#0043:1: %d\n",temp1.e);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
49 printf("#0044:1: %d\n",temp1.b);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
50 printf("#0045:2: %d\n",temp2.c);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
51 printf("#0046:2: %d\n",temp2.e);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
52 printf("#0047:2: %d\n",temp2.b);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
53 printf("#0048:2: %d\n",(void*)temp3.c==b);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
54 printf("#0049:2: %d\n",temp3.c==(int)b);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
55 printf("#0050:2: %d\n",temp3.a==(int)&b);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
56 printf("#0051:2: %d\n",temp4.m.j);
492f06738550 working... (struct init fix)
kono
parents: 491
diff changeset
57 printf("#0051:2: %d\n",temp5.m.j);
448
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
58 return 0;
422415e15eb8 *** empty log message ***
kono
parents:
diff changeset
59 }