Mercurial > hg > CbC > old > device
comparison test/tstdarg.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 | 5313ed059cee |
children |
comparison
equal
deleted
inserted
replaced
895:e9ba80b0827d | 896:d712ee10feb7 |
---|---|
41 va_start(ap,numtypes); | 41 va_start(ap,numtypes); |
42 print(&ap); | 42 print(&ap); |
43 while((t= *numtypes++)) { | 43 while((t= *numtypes++)) { |
44 if (t=='i') { | 44 if (t=='i') { |
45 i = va_arg(ap,int); | 45 i = va_arg(ap,int); |
46 printf("#0020:int arg: %d\n",i); | 46 printf("#0045:int arg: %d\n",i); |
47 print(&ap); | 47 print(&ap); |
48 | 48 |
49 #if 0 /* ‘float’ is promoted to ‘double’ when passed through ‘...’ */ | 49 #if 0 /* ‘float’ is promoted to ‘double’ when passed through ‘...’ */ |
50 } else if (t=='f') { | 50 } else if (t=='f') { |
51 f = va_arg(ap,float); | 51 f = va_arg(ap,float); |
52 printf("#0025:float arg: %g\n",f); | 52 printf("#0051:float arg: %g\n",f); |
53 #endif | 53 #endif |
54 } else if (t=='d') { | 54 } else if (t=='d') { |
55 d = va_arg(ap,double); | 55 d = va_arg(ap,double); |
56 printf("#0029:double arg: %g\n",d); | 56 printf("#0055:double arg: %g\n",d); |
57 print(&ap); | 57 print(&ap); |
58 } else if (t=='l') { | 58 } else if (t=='l') { |
59 l = va_arg(ap,long long); | 59 l = va_arg(ap,long long); |
60 printf("#0032:long long arg: %lld\n",l); | 60 printf("#0059:long long arg: %lld\n",l); |
61 print(&ap); | 61 print(&ap); |
62 } else if (t=='s') { | 62 } else if (t=='s') { |
63 s = va_arg(ap,char *); | 63 s = va_arg(ap,char *); |
64 printf("#0035:char *arg: %s\n",s); | 64 printf("#0063:char *arg: %s\n",s); |
65 print(&ap); | 65 print(&ap); |
66 } else { | 66 } else { |
67 s = va_arg(ap,char *); | 67 s = va_arg(ap,char *); |
68 printf("#0038:arg: error\n"); | 68 printf("#0067:arg: error\n"); |
69 print(&ap); | 69 print(&ap); |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |