V
Vincent Rivière
Hello.
I experience a problem when calling a macro with an expression containing a
comma.
$ cat bug.c
#define M(x, y) x,y
#define A(x) x
#define B(x) A(x)
B(M(a,b))
$ gcc -E bug.c
....
bug.c:5:9: error: macro "A" passed 2 arguments, but takes just 1
GCC (all versions) fails with that error
HP-UX cc fails with similar error
Visual C++ (all versions) accepts that code and produces the obvious result:
a,b
Which compiler is right ?
How can I make GCC act as Visual C++ ?
I experience a problem when calling a macro with an expression containing a
comma.
$ cat bug.c
#define M(x, y) x,y
#define A(x) x
#define B(x) A(x)
B(M(a,b))
$ gcc -E bug.c
....
bug.c:5:9: error: macro "A" passed 2 arguments, but takes just 1
GCC (all versions) fails with that error
HP-UX cc fails with similar error
Visual C++ (all versions) accepts that code and produces the obvious result:
a,b
Which compiler is right ?
How can I make GCC act as Visual C++ ?