RE: variadic macros
"Ivan-Assen Ivanov" <[email protected]> Tue, 21 Dec 2004 13:13:16 +0200
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
> 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?
If the variable parameters are ultimately destined to go into a printf-like
function (which I guess is the common case), we do the following:
PRINT(dbg_category)("%d %d", something, something)
dbg_category is on object of a class use to categorize debug printout
messages, e.g. to filter them, to disable them selectively etc.
This expands to something like that:
dbgCategory.Enabled() ? 0 : GlobalSetFileLine(__FILE__, __LINE__) ? 0 : dbgCategory.Print
Where the Print method of the debug categories is variadic and transfers its va_arg to
a real sprintf.
-------------------------------------------------------
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_id=555