--- On Sat, 6/21/08, Andrew Haley <aph@xxxxxxxxxx> wrote: > From: Andrew Haley <aph@xxxxxxxxxx> > Subject: Re: #if does not work! > To: unga888@xxxxxxxxx > Cc: gcc-help@xxxxxxxxxxx > Date: Saturday, June 21, 2008, 5:17 PM > Unga wrote: > > Hi all > > > > I'm using the gcc 4.3.1 on FreeBSD 7.0. The > following #if block does not work as expected: > > > > #if LDBL_MANT_DIG == 64 > > static const long double split = 0x1p32L + > 1.0; > > #elif LDBL_MANT_DIG == 113 > > static const long double split = 0x1p57L + > 1.0; > > #endif > > > > Where the LDBL_MANT_DIG is defined as 64 as a #define > on a separate include file. The compiler finds the variable > split is not declared. It does not complain the include file > is not found, therefore, I presume include file is found and > included. > > > > Is this a known issue? Is it possible to rewrite the > code so that compiler can work properly. > > Please reproduce this problem in a small self-contained > test case, them > I'll have a look. > Hi Andrew, thanks for the reply. I'm really sorry, I came to a fast conclusion, my tests shows #if works well. It made me alarm to learn the real issue behind this. Here is a test case: #include <stdio.h> #include <float.h> main() { printf("%d\n", LDBL_MANT_DIG); } In float.h, the LDBL_MANT_DIG is defined as: #define LDBL_MANT_DIG 64 I compile the above test program as: gcc -I/tools/include -I/tools/usr/include -o test test.c ./test prints 53!!!! The reason is, it is not taking the float.h from /tools/usr/include, but from /tools/lib/gcc/i386-unknown-freebsd7.0/4.3.1/include/float.h . Rename the /tools/lib/gcc/i386-unknown-freebsd7.0/4.3.1/include/float.h to something else and compile the test.c and run prints 64. Programs I compile should get their header files only from /tools/include and /tools/usr/include. 1. How do I instruct the gcc to get headers only from directories I want? 2. Do I need /tools/lib/gcc/i386-unknown-freebsd7.0/4.3.1/include/ anymore? Can I either remove or rename after the gcc is installed? Appreciate your reply on this. Best Regards Unga