?
Solved

Using va_arg for variable params in a macro

Posted on 2001-06-19
2
Medium Priority
?
1,212 Views
Last Modified: 2008-01-16
A colleague wrote me:

"I recently ran across some info about some new C standard allowing a variable number of arguments in a macro via the macro __VA_ARGS__. Does MS C++ allow this in macro's?"

I have never heard of __VA_ARGS__ but found a proposal for it in a document dated 1999, with no followup.  Any info out there?

Is there a way to use the va_arg macro to allow a variable number of parameters in a macro?
0
Comment
Question by:appleby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
IainHere earned 300 total points
ID: 6206832
__VA_ARGS__ is part of the C99 standard.  It is certainly not supported by VC++ 6.0, along with most of the other additions to the language made by C99.

For example, try compiling the following [legal under C99]:

#define DoLogFile(...) fprintf(stderr, __VA_ARGS__)
0
 

Author Comment

by:appleby
ID: 6206860
Ok, thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question