help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Eliminate Function Call in Conditional Macro


From: Shigeru Mabuchi
Subject: Eliminate Function Call in Conditional Macro
Date: Tue, 13 Aug 2002 17:34:17 +0900

Hello, I'm new to this mailing list.

I use the following macro in my Visual C source codes.

#ifdef _TRACE
#define TRACE  Trace
#else
#define TRACE ((void)0)
#endif

 where I have a Trace(const char* format,...) function
defined. A line likes

  TRACE("Counter is %n\n",counter);

 will work in debug codes, and this line itself will
be eliminated in the release codes.

 I transport this codes to gcc (2.95) but the (void)0
gives me an error when _TRACE is not defined: 

 'void value not ignored as it ought to be'

 Is there any way to do this on gcc?

 Thanks.

S. Mabuchi
WING
http://www.wing.gr.jp/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]