> "Krzysztof Kowalczyk" <[EMAIL PROTECTED]> writes: > > > The other form works for both msvc and gcc (see > > http://codepad.org/VxF4pBHg for a proof (well, a proof that it > > compiles with gcc, or at least a version of gcc)) so the #ifdef isn't > > necessary, just use __VA_ARGS__ version. I verified that it compiles > > with msvc 2005. > > Using __VA_ARGS__ is not quite correct with GCC. You should be able > to call the _send (or _sendv) macro without supplying any arguments > after RCV. The comma preceding __VA_ARGS__ causes a syntax error > under GCC when there are no other arguments, but if you use ##ARG it > deletes the comma and all is well. > > Does MSVC compile properly without arguments? > > i.e. does: > > _send("abc", 123) > > cause a syntax error?
Good point. MSVC handles that according to http://msdn2.microsoft.com/en-us/library/ms177415(VS.80).aspx and this test program, which compiles and works as expected with msvc (and doesn't compile on gcc): #include <stdio.h> #define np(s, ...) \ printf(s, __VA_ARGS__) int main(int argc, char **argv) { int d = 4; np("hello\n"); np("s %d", d); return 0; } So #ifdef is needed after all. Alternatively, all places where _send(a,b) is used, could be changed to _send0(a,b). -- kjk _______________________________________________ fonc mailing list [email protected] http://vpri.org/mailman/listinfo/fonc
