freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Minor misc patches to freetype cvs, from custom chang


From: David Turner
Subject: Re: [ft-devel] Minor misc patches to freetype cvs, from custom changes in vtk
Date: Thu, 22 Mar 2007 09:35:56 +0100

On Thu, 22 Mar 2007 11:43:58 +0900, "Miles Bader" <address@hidden> said:
> "David Turner" <address@hidden> writes:
> > this will generate an error with certain compilers/pre-processors if
> > __LP64__ is not defined.  generally speaking #if XXXXX is not a
> > portable statement, except if you ensure that the macro is always
> > defined beforehand.
> 
> Is this true according to the C standard, or a problem with any
> non-obsolete compilers?
> 

This is one of these things that are certainly not clarified in the C standard 
[1],
which specifies that #if shall be followed by any "constant-expression", the 
latter
being defined very loosely in the C language description, and specific 
constraints
not really detailed.

So "#if FOO, where FOO is undefined" is ok with GNU cpp [2] but not with Visual 
C++ [3]
I haven't looked at other compilers, but I wouldn't be surprised to see that 
this is
a GNU-specific extension, or it may come from a tradition of various Unix 
pre-processors,
but certainly can't be generalized...

> [I ask because such usage is widespread, and although gcc has a warning
> for
> it, it doesn't get turned on even with "-ansi -pedantic -Wall -Wextra",
> you have to enable it explicitly.]
> 

I have no idea why, I suppose that forcing -Wundef with "-ansi -pedantic" would
have created problems when compiling a lot of code, due to its widespread usage
in Unix sources.

Hope this helps,

- David

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
[2] http://gcc.gnu.org/onlinedocs/cpp/If.html#If
[3] 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vcrefPreprocessorReference.asp





reply via email to

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