[cfe-dev] #define behavior

Bill Wendling isanbard at gmail.com
Wed Dec 5 01:52:27 PST 2007

Here's an interesting question that occurred in one of the OCCC  
entries that I was compiling with clang. This program:

$ cat d.c
#define x =

int foo(int *k) {
   return *k *x 37;

Generates this:

$ clang -ast-print d.c -triple=i686-apple-darwin9
typedef char *__builtin_va_list;
d.c:4:14: error: expected expression
   return *k *x 37;

int foo(int *k) {

1 diagnostic generated.

GCC also balks at this. It appears that there's a space being  
inserted after the "*" and before the "=" that "x" becomes. Is this  


More information about the cfe-dev mailing list