gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Re: Stack over-run


From: Trevor Morris
Subject: Re: [gnugo-devel] Re: Stack over-run
Date: Sat, 16 Feb 2002 21:38:32 -0500

At 10:52 PM 2/16/2002 +0100, Gunnar Farneback wrote:
>Dan wrote:
>> #define TRACE  if (!(verbose)) ; else gprintf
>> #define RTRACE if (!(verbose >= 3)) ; else gprintf
>> #define VTRACE if (!(verbose >= 4)) ; else gprintf
>> /* if debug == 0, then can skip the function call. */
>> #define DEBUG  if (!debug) ; else DEBUG_func
>> 
>> that causes the warnings. These definitions were changed
>> in the patch trevor_1_25.2. If we then use
>> 
>> if (condition) TRACE( ...)
>> 
>> this unravels to
>> 
>> if (condition) if (!verbose) ; else gprintf( )
>> 
>> which of course is ambiguous.
>
>The common macro idiom
>
>do { \
>  ... \
>} while (0)
>
>is safe against this problem.

Unfortunately, this idiom doesn't work for the TRACE family.
The variable argument list can't be passed in.  That is, there
is no way to put the "} while (0)" part after the argument
list (unless you have variadic macros).

-Trevor





reply via email to

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