comparison test/tmp11.c @ 896:d712ee10feb7

local_nptr for locally defined struct
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 06 Apr 2014 19:20:58 +0900
parents bc919d849346
children
comparison
equal deleted inserted replaced
895:e9ba80b0827d 896:d712ee10feb7
6 NMTBL *a; 6 NMTBL *a;
7 NMTBL f; 7 NMTBL f;
8 8
9 NMTBL * 9 NMTBL *
10 test2(char *n) { 10 test2(char *n) {
11 printf("#0009:s %s\n",n); 11 printf("#0010:s %s\n",n);
12 return a; 12 return a;
13 } 13 }
14 14
15 int 15 int
16 test0(int a,int b,int c) { 16 test0(int a,int b,int c) {
17 printf("#0015:a %d b %d c %d\n",a,b,c); 17 printf("#0016:a %d b %d c %d\n",a,b,c);
18 return 0; 18 return 0;
19 } 19 }
20 20
21 int 21 int
22 test1(a,b,c) 22 test1(a,b,c)
36 NMTBL *b; 36 NMTBL *b;
37 f.nm = "_name"; 37 f.nm = "_name";
38 a = &f; 38 a = &f;
39 b = test2("test"); 39 b = test2("test");
40 d = test1(1,2,3); 40 d = test1(1,2,3);
41 printf("#0033:return %d\n",d); 41 printf("#0040:return %d\n",d);
42 42
43 NMTBL **p = (NMTBL**)&heap[2]; 43 NMTBL **p = (NMTBL**)&heap[2];
44 *p = &f; 44 *p = &f;
45 b = &f; 45 b = &f;
46 int e = 0; 46 int e = 0;
47 printf("f.nm %s\n",f.nm); 47 printf("#0046:f.nm %s\n",f.nm);
48 printf("b->nm %s\n",b->nm); 48 printf("#0047:b->nm %s\n",b->nm);
49 printf("(*p)->nm %s\n",(*p)->nm); 49 printf("#0048:(*p)->nm %s\n",(*p)->nm);
50 printf("ncaddr(e)->nm %s\n",ncaddr(e)->nm); 50 printf("#0049:ncaddr(e)->nm %s\n",ncaddr(e)->nm);
51 51
52 return d; 52 return d;
53 } 53 }
54 54
55 /* end */ 55 /* end */