david%ics.com@BU.EDU (12/06/89)
This is the behavior with gcc 1.36 (no fixes) on a Sun 4/60:
#include <stdio.h>
#define A(x)
#define B(x,y)
#define C(x,y)
main()
{
A(); /* flagged by gcc but not cc */
B(); /* flagged by gcc and cc */
C(,); /* not flagged by gcc or cc */
}
gcc testing.c
testing.c:9: no args to macro `A'
testing.c:10: no args to macro `B'
cc testing.c
testing.c: 10: B: argument mismatch
I can see that C is OK and I can see that B could be considered not OK.
But the different handling of A is a problem in that there does not seem
to be a general way to indicate 0 arguments to that macro.
gcc -traditional testing.c
testing.c:10: no args to macro `B'
So is this behavior really ANSI, or is there something else going on?