Preprocessor Variable argument lists

조회수 11회
읽지 않은 첫 메시지로 건너뛰기

David Cowan

읽지 않음,
2003. 1. 14. 오전 6:36:5203. 1. 14.
받는사람
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


john

읽지 않음,
2003. 1. 14. 오전 7:24:3403. 1. 14.
받는사람
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);

"David Cowan" <David...@vissci.com> wrote

Carl Daniel [MVP]

읽지 않음,
2003. 1. 14. 오전 10:10:5403. 1. 14.
받는사람
"David Cowan" <David...@vissci.com> wrote in message
news:eTXXYF8uCHA.848@TK2MSFTNGP11...

> 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


Ronald Laeremans [MSFT]

읽지 않음,
2003. 1. 14. 오후 2:19:2603. 1. 14.
받는사람
No, we will not be supporting variadic macros in either 7.1 or in the Yukon
release.

Ronald Laeremans
Visual C++ team

"Carl Daniel [MVP]" <cpda...@nospam.mvps.org> wrote in message
news:uZlGb89uCHA.1644@TK2MSFTNGP09...

Ron Ruble

읽지 않음,
2003. 1. 15. 오후 12:39:0203. 1. 15.
받는사람

"Ronald Laeremans [MSFT]" <ron...@online.microsoft.com> wrote in message news:ut7USHAvCHA.2476@TK2MSFTNGP10...

> 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?

Brandon Bray [MSFT]

읽지 않음,
2003. 1. 15. 오후 4:46:1403. 1. 15.
받는사람
Ron Ruble wrote:
>
> 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.

> Other?

Not really.

Cheerio!

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


전체답장
작성자에게 답장
전달
새 메시지 0개