
Paul Mensonides <pmenso57 <at> comcast.net> writes:
On Sun, 13 Nov 2011 21:10:11 -0800, Jeffrey Lee Hellrung, Jr. wrote:
I'm just curious, is
-------- #define A(...) A(,) --------
legal?
Yes. "Empty" is a valid argument in >= C99 and >= C++0x. An example of when an empty argument actually appears when passing around a cv- qualifier: nothing | const | volatile | const volatile. This is only one of many many scenarios where emptiness is a valid element and has meaning.
Yes. This all is "legal" and "valid", but does it have meaning? I doubt it. Show me sane example where one would develop macro FOO which takes two arguments and tell users to invoke it like this FOO(,) or FOO(a,) or FOO(a,b). Instead one can present a macro which takes variadic data and does different things depending on how many arguments passed (0, 1, or 2). So the invocations would look like FOO(), FOO(a), FOO(a,b) - much better IMO. FOO(,) is a stone in a road to awk-like hell and should be strictly forbidden from the end user code. It might only be used in some corner cases deep in library code and never exposed. So, all the theoretical corner cases aside FOO() should be invocation with zero arguments and FOO(a) with one. Regards, Gennadiy