Preprocessor Variable argument lists 
Author Message
 Preprocessor Variable argument lists

Does VC 7 support variable argument lists in preprocessor directives ?
If not, are there any future plans to support this, or any way around it
that anyone can think of ?

Eg.

#ifndef NDEBUG
#    define    DEBUG_PRINTF( string, ... )            (0)
#else
#    define    DEBUG_PRINTF( string, ... )            printf( string,
__VA_ARGS__ )
#endif



Sat, 02 Jul 2005 19:36:52 GMT  
 Preprocessor Variable argument lists
Look at the _RPT macros in <crtdbg.h>. You will have to define different
macros for each number of arguments you want, e.g.

    _RPT0(_CRT_WARN, "foo");
    _RPT1(_CRT_WARN, "foo %d", i);
    _RPT2(_CRT_WARN, "foo %d %s", i, szString);


Quote:
> Does VC 7 support variable argument lists in preprocessor directives ?
> If not, are there any future plans to support this, or any way around it
> that anyone can think of ?

> Eg.

> #ifndef NDEBUG
> #    define    DEBUG_PRINTF( string, ... )            (0)
> #else
> #    define    DEBUG_PRINTF( string, ... )            printf( string,
> __VA_ARGS__ )
> #endif



Sat, 02 Jul 2005 20:24:34 GMT  
 Preprocessor Variable argument lists

Quote:
> Does VC 7 support variable argument lists in preprocessor directives ?
> If not, are there any future plans to support this, or any way around it
> that anyone can think of ?

No it does not.  These so-called variadic macros were added to C in the C99
spec.  It's possible that a future version (past VC7.1) will support
variadic macros, but no announcement to that effect has been made.

You might want to look into the Boost Preprocessor Library in the meantime
to see if it can address your needs.  www.boost.org.

-cd



Sat, 02 Jul 2005 23:10:54 GMT  
 Preprocessor Variable argument lists
No, we will not be supporting variadic macros in either 7.1 or in the Yukon
release.

Ronald Laeremans
Visual C++ team



Quote:


> > Does VC 7 support variable argument lists in preprocessor directives ?
> > If not, are there any future plans to support this, or any way around it
> > that anyone can think of ?

> No it does not.  These so-called variadic macros were added to C in the
C99
> spec.  It's possible that a future version (past VC7.1) will support
> variadic macros, but no announcement to that effect has been made.

> You might want to look into the Boost Preprocessor Library in the meantime
> to see if it can address your needs.  www.boost.org.

> -cd



Sun, 03 Jul 2005 03:19:26 GMT  
 Preprocessor Variable argument lists


Quote:
> No, we will not be supporting variadic macros in either 7.1 or in the Yukon
> release.

Considering other C99 enhancements for Yukon?

long long? Other?



Mon, 04 Jul 2005 01:39:02 GMT  
 Preprocessor Variable argument lists

Quote:

> long long?

long long is mostly available. The compiler supports long long as an alias
for __int64. The library functions do not conform to C99 though. This is not
expected to change in the near future.

Quote:
> Other?

Not really.

Cheerio!

--
Brandon Bray                                          Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.



Mon, 04 Jul 2005 05:46:14 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. variable argument lists (va_arg)--determining number of arguments

2. Variable length arguments for Preprocessor?

3. Question about a variable argument list in managed c++

4. calling unmanaged function with variable list of arguments (ellipses) failed

5. variable argument lists

6. Passing variable lenght argument list

7. Passing variable argument list

8. Call interpreted variable argument list

9. Passing a structure to a variable argument list

10. Passing on variable argument list

11. Variable argument list (c.f. printf())

12. variable argument lists

 

 
Powered by phpBB® Forum Software