From: Luis L. <lui...@gm...> - 2012-02-12 20:39:15
|
Hello, I'm compiling a C program that sets floating point control word: <test.c> #include <float.h> int main(void) { /* set FPU precision to 64-bit and round to nearest */ _controlfp( _PC_64|_RC_NEAR, _MCW_PC|_MCW_RC ); return 0; } </test.c> Which results in the following: V:\>gcc test.c -o test.exe test.c: In function 'main': test.c:6:14: error: '_PC_64' undeclared (first use in this function) test.c:6:14: note: each undeclared identifier is reported only once for each function it appears in test.c:6:21: error: '_RC_NEAR' undeclared (first use in this function) test.c:6:31: error: '_MCW_PC' undeclared (first use in this function) test.c:6:39: error: '_MCW_RC' undeclared (first use in this function) Here is defined in MSDN: http://msdn.microsoft.com/en-us/library/e9b52ceh(v=vs.71).aspx But peeking into float.h seems that those elements are only defined if __STRICT_ANSI__ is not defined... Why is __STRICT_ANSI__ defined even if I haven't requested it? Looking at GCC documentation. http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html Says that __STRICT_ANSI__ is defined when -ansi is used. Also mentions that non-ISO compliant are not rejected gratuitously unless -pedantic option is provided (which wasn't on this case). GCC version in use is 4.6.2, mingwrt is 3.20 and w32api is 3.17-2. Thanks in advance and pardon my ignorance. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exupéry |