RE: [GD-Windows] variadic macros
Brought to you by:
vexxed72
From: Paul B. <pa...@wi...> - 2004-12-21 09:47:19
|
> -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Brett Bibby > Sent: Tuesday, December 21, 2004 1:55 AM > To: Gam...@li... > Subject: [GD-Windows] variadic macros >=20 > Is there any way to support variadic macros in Visual Studio=20 > like gcc supports? If not, how do people write stuff like=20 > custom asserts that take variable parameters? >=20 > http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html >=20 > Thanks! > Brett Depending on what you're after, you might find that the __noop intrinsic will help you out. #ifdef _DEBUG void _MyDebugPrintf(const char* fmt, ...); #define DPF _MyDebugPrintf #else #define DPF __noop #endif // later, ... DPF("%s %s this works", FuncA(), FuncB()); FuncA and FuncB (or parameters in general) are not evaluated in non _DEBUG builds. The compiler ignores the statement. This is obviously not variadic macros, but you can do quite a bit with it. Paul |