is there a way to write macros with a variable argument list in visual C++?

Question :

is there a way to write macros with a variable argument list in visual C++?,

Answer :

As far as I know, in gcc you can write something like:

#define DBGPRINT(fmt...) printf(fmt);  

Is there a way to do that in VC++?

,

Yes but only since VC++ 2005. The syntax for your example would be:

#define DBGPRINT(fmt, ...) printf(fmt, __VA_ARGS__)  

A full reference is

That’s the answer is there a way to write macros with a variable argument list in visual C++?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Read More  Generate sitemap on the fly

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you