gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Even more warnings :)


From: Dave Denholm
Subject: Re: [gnugo-devel] Even more warnings :)
Date: 25 Feb 2002 16:47:58 +0000

Trevor Morris <address@hidden> writes:

> >If we are still talking about the version
> >
> >#define TRACE  (verbose) && gprintf
> >
> >then perhaps a compromise might be to make a global dummy variable, and then 
> >use
> >
> >  dummy = (verbose) && gprintf
> >
> >
> >It adds a little overhead, but much less than a function call.
> 
> I think this is an excellent idea.  (And yes, that's what
> we're talking about!)
> 
> The dummy variable only needs to be defined on non-variadic and
> non-VC systems.
> 


> BTW, is there a standard way to force a compiler warning message 
> that this variable assignment is being used?  For example:
>   #pragma message("warning: TRACE function using assignment.")
> 

Not sure. gcc info page mentions #warning  but doesn't say whether
it is standard or an extension (which may mean it is standard)


Unfortunately, you cannot necessarily do things like

#if defined(_MS_C_)
# pragma message("...")
#elif defined(_GNUC__)
# warning ...
#else
...
#endif

since if the cpp fails to understand a directive, it may decide
that it cannot properly resolve the nesting of the ifs, and so
give up entirely, rather than just ignoring it. ISTR encountering
such behaviour when I used to work on gnuplot.

However, gnuplot tried valiantly to support non-ansi compilers.
If gnugo requires ansi c (or "better"), then it's less of
a problem.

( #pragma is defined as an ansi directive, but it is
 implementation dependent.  Which means that gcc is perfectly
 entitled to define that 

  #pragma message("..")

 means fail the compile. The gcc people dont like #pragma !
)



dd
-- 
address@hidden          http://www.insignia.com



reply via email to

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