RE: variadic macros
"Paul Bleisch" <[email protected]> Tue, 21 Dec 2004 02:40:00 -0800
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <FD16260E2EDF204E80A22FB904A425C30B098F81@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 2:42 AM > To: [email protected] > Subject: Re: [GD-Windows] variadic macros > > > Paul Bleisch wrote: > > Depending on what you're after, you might find that the __noop > > intrinsic will help you out. > > > > That's new, thanks. I don't think I can use it still though > as I need to insert some parameters before calling the debug function. > > This is what we have on other platforms: > > #define MPE_SHELL_ERROR_LOG(...) \ > MpiShellLogTextAdd(__FILE__, \ > (MpeChar *)__func__, \ > __LINE__, \ > MPE_SHELL_LOG_FLAG_ERROR, \ > __VA_ARGS__) > > > I want to insert the file, func and line number. (BTW, does > windows allow __func__ ?) > > Thanks again, > Brett __func__ is not, but __FUNCTION__ is available (which I think is equivalent). A potential workaround for your varargs macros is to do something like: #ifdef _DEBUG void _SetDebugInfo(MpeChar* file, MpeChar* func, int line, unsigned flags); void _DebugPrint(char* fmt, ...); #define MPE_SHELL_ERROR_LOG _SetDebugInfo(__FILE__, __FUNCTION__, __LINE__, MPE_SHELL_LOG_FLAG_ERROR), _DebugPrint #else #define MPE_SHELL_ERROR_LOG __noop #endif this is not threadsafe and not a 1:1 replacement for your current code, so beware. 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