Alex Rivera | Logout

Optional Parameters with C++ Macros

Asked 2010-06-15T16:02:46.143
148

Is there some way of getting optional parameters with C++ Macros? Some sort of overloading would be nice too.

Edit
Report

1 Answer

-1

None of the above examples (from Derek Ledbetter, David Sorkovsky, and Joe D) to count arguments with macros worked for me using Microsoft VCC 10. The __VA_ARGS__ argument is always considered as a single argument (token-izing it with ## or not), so the argument shifting in which those examples rely doesn't work.

So, short answer, as stated by many others above: no, you can't overload macros or use optional arguments on them.

answered 2012-03-30T19:41:31.127

Your Answer