RE: variadic macros
"Paul Bleisch" <[email protected]> Tue, 21 Dec 2004 01:46:58 -0800
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <FD16260E2EDF204E80A22FB904A425C30B098F7E@WIN-MSG-10.wingroup.windeploy.ntdev.microsoft.com> |
> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On > Behalf Of Brett Bibby > Sent: Tuesday, December 21, 2004 1:55 AM > To: [email protected] > Subject: [GD-Windows] variadic macros > > Is there any way to support variadic macros in Visual Studio > like gcc supports? If not, how do people write stuff like > custom asserts that take variable parameters? > > http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html > > 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 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5