This is the mail archive of the
mailing list for the cygwin project.
RE: gcc-3.3.3 :fpclassify
- From: Jianguo dot Zhang at inrialpes dot fr
- To: Talk Amongst Yourselves <cygwin-talk at cygwin dot com>
- Date: Sat, 1 Jan 2005 10:37:46 +0100
- Subject: RE: gcc-3.3.3 :fpclassify
- Envelope-from: email@example.com
- Envelope-to: firstname.lastname@example.org
- References: <NUTMEGQbKCO2ev2zosG00000b47@NUTMEG.CAM.ARTIMI.COM>
- Reply-to: Talk Amongst Yourselves <cygwin-talk at cygwin dot com>
gcc 3.4.1 works with this simple file.
引用 Dave Korn <email@example.com>:
> > -----Original Message-----
> > From: cygwin-talk-owner On Behalf Of Jianguo.Zhang
> > Sent: 30 December 2004 20:56
> > The gcc/g++ version is 3.3.3
> > I am trying to compile the following program using g++ 3.3.3
> > if (FP_ZERO != std::fpclassify (a)) abort ();
> > if (FP_NAN != std::fpclassify (b)) abort ();
> > if (FP_NORMAL != std::fpclassify (c)) abort ();
> > When I use the following command to compile this file under cygwin:
> > $ g++ test.cpp
> > the following errors occurs:
> > test.cpp: In function `int main()':
> > test.cpp:17: error: `fpclassify' undeclared in namespace `std'
> > test.cpp:18: error: `fpclassify' undeclared in namespace `std'
> > test.cpp:19: error: `fpclassify' undeclared in namespace `std'
> > there is no problem to compile the file under linux system
> > using g++ 3.3.1
> > Could anyone tell me why?
> It changed in 3.3.3; in earlier versions it was indeed in namespace std.
> It is a macro, defined in /usr/include/math.h, which is included by cmath,
> then (since 3.3.3) cmath has a section that undefines it again; this is
> apparently for strict c++ standard conformance.
> In gnu libstdc++, the macro is placed into namespace __gnu_cxx before it
> undefined, used to make a template function that will accept any type, and
> imported from there to std:: later. This is under the control of two
> _GLIBCPP_USE_C99 and _GLIBCPP_USE_C99_FP_MACROS_DYNAMIC. Unfortunately,
> can't just be set at the top of your code before the #includes, as then
> goes and breaks. These defines live in
> /usr/include/c++/3.3.3/i686-pc-cygwin/bits/c++config.h, and they are created
> the time the compiler itself is being configured and built.
> The cygwin compiler, it seems, was compiled without using the
> option at configure time, whereas the linux version you've used was.
> and follow ups, and particularly the referenced thread
> make it clear what's going on.
> There are various answers and workarounds. One would be to recompile gcc
> (perhaps just libstdc++ would be enough) for cygwin with --enable-c99.
> would be to copy the definitions into your own code from math.h.
> Gerrit, does the output from "gcc -v" for 3.4.1 show "--enable-c99"? Or
> someone fixed it in the headers somehow?
> Can't think of a witty .sigline today....