recently I was browsing SO and I came across this topic, where Sam Jansen is declaring a macro PACKED_STRUCT(name)
, but in code he is using it once with no arguments and once with the name argument supplied.
I tried to compile a similar sample progam with GCC 4.6.1 and I was surprised it compiled fine with no warnings at all (I was using -std=c99 -Wall -Wextra -pedantic
command line switches).
However when I tried to make two argument macro and call it with less than two arguments, it did not work.
So my question is if this is a bug in GCC, or it is a feature of GCC, or it is defined somewhere in the standard, that it has to work like this?
According to this page in GCC's documentation, this should not be possible.