Mercurial > hg > CbC > old > device
view test/macro.c @ 647:fe23fe842b82
*** empty log message ***
author | kono |
---|---|
date | Fri, 17 Nov 2006 20:00:37 +0900 |
parents | 4e08fbf6754b |
children | 0554b7f985ee |
line wrap: on
line source
int printf(const char *format, ...); int heap[100]; #define car(e) (heap[(int)(e)]) #define cadr(e) (heap[((int)(e))+1]) #define TEST int i; TEST char *a = "test" "test"; #define TEST0 33 #define TEST111 TEST0 #define c(a,b) g(a+1,b+1) #define g(a,b) printf("#0018:%d %d\n",a+1,b+1); #define d(a,b) cadr(b)+3 /* #define stdio stdio #define f(a,b) aho+a+b f (a,b) */ // name concateneation #define name(a,b) name_##b(a) #define names(a,b) name_ ## b(a) #define name_hoge(c) (c+a) #define hoge000(a) (a+a) /* hoge comment */ int main() { int a,b,e; b = heap[TEST111]; d(a,b); a =1; b = 3; #ifndef a c(a, b); /* 3,5 expected */ #endif e=50; heap[51]=3; heap[3]=4; /* 5,4 expected */ #if 0 g(car(cadr(e)),cadr(e)); #endif #if 0 printf("#0054:1\n"); #elif (1) printf("#0056:2\n"); #elif (2) printf("#0058:3\n"); #else printf("#0060:4\n"); #endif #if 0 printf("#0063:1\n"); #elif (0) printf("#0065:2\n"); #elif (0) printf("#0067:3\n"); #else printf("#0069:4\n"); #endif printf("#0071:%d\n",name(3,hoge)); printf("#0072:%d\n",names(3,hoge)); printf("#0073:%d\n",hoge000(3)); return 0; } /* For GCC 2.7 and later, we can use specific type-size attributes. */ # define __intN_t(N, MODE) \ typedef int int##N##_t __attribute__ ((__mode__ (MODE))) # define __u_intN_t(N, MODE) \ typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) # ifndef __int8_t_defined # define __int8_t_defined __intN_t (8, __QI__); __intN_t (16, __HI__); __intN_t (32, __SI__); __intN_t (64, __DI__); # endif __u_intN_t (8, __QI__); __u_intN_t (16, __HI__); __u_intN_t (32, __SI__); __u_intN_t (64, __DI__); int tmp() #if 0 { return 1; } #else { return 0; } #endif #if 0 #endif /* whoeh wohefwiehfoi */ void longlong(int i,int j) { // long long i,j; if (i>j) main(); }