c++/3876: c++ #define INFINITY in cmath

Ross Smith ross.s@ihug.co.nz
Mon Jul 30 16:04:00 GMT 2001


aoliva@gcc.gnu.org wrote:
> 
> Synopsis: c++ #define INFINITY in cmath
> 
> State-Changed-From-To: open->closed
> State-Changed-By: aoliva
> State-Changed-When: Mon Jul 30 13:52:34 2001
> State-Changed-Why:
>     INFINITY is specified as a macro in math.h in the C99 Standard,
> and the C++98 Standard says the contents of <cmath> are the same as
> those of <math.h> in the C Standard.

No, it says it's the same as <math.h> in the _C89_ standard. The C++
standard explicitly includes the C89 standard, not whichever version of
the C standard happens to be current at any particular time. A <cmath>
header that defines INFINITY is in violation of the C++ standard,
regardless of what C99 has to say about it.

> this is not a problem in GCC, but in glibc, which is
> where the definition of the macro comes from.

That's true, of course.

-- 
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army."                  -- Neal Stephenson



More information about the Gcc-bugs mailing list