On Thu, 2007-03-22 at 04:35 -0400, David Turner wrote: > On Thu, 22 Mar 2007 11:43:58 +0900, "Miles Bader" > <[EMAIL PROTECTED]> said: > > "David Turner" <[EMAIL PROTECTED]> 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.
The relevant part is where it says how to handle incorrect expression syntax in an #if statement. Because where FOO is undefined, #if FOO expands to a null expression which is not a valid one... > 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... Well, a trick I have used in one of my projects is to write "#if FOO+0" but most people don't like it. -- behdad http://behdad.org/ "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety." -- Benjamin Franklin, 1759 _______________________________________________ Freetype-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype-devel
