bin/53870: C++ undeclares standard math functions like isinf()
David Schultz
das at FreeBSD.ORG
Sun Jun 29 22:21:30 PDT 2003
On Sat, Jun 28, 2003, Michael van Elst wrote:
> The following reply was made to PR bin/53870; it has been noted by GNATS.
>
> From: Michael van Elst <mlelstv at dev.de.cw.net>
> To: Artem 'Zazoobr' Ignatjev <timon at memphis.mephi.ru>
> Cc: FreeBSD-gnats-submit at freebsd.org
> Subject: Re: bin/53870: C++ undeclares standard math functions like isinf()
> Date: Sat, 28 Jun 2003 13:10:08 +0200
>
> On Sat, Jun 28, 2003, Artem 'Zazoobr' Ignatjev wrote:
>
> > > #include <cmath>
> > Add:
> > using namespace std;
>
> Thanks, this helps. Can you explain why this is necessary for isinf()
> but not for functions like sin() ?
<cmath> is supposed to place symbols in the std namespace, not the
global namespace. The fact that sin() is put into the global
namespace when you include <cmath> is a bug in libstdc++. If you
use '#include <math.h>' instead, these symbols *will* wind up in
the global namespace, but that approach is deprecated.
> The only difference seems to be that isinf() happens to implemented as
> a macro (it used to be a function in FreeBSD4).
C99 requires it to be a macro, since that's the only way it can
correctly accept arguments of multiple types in C.
More information about the freebsd-bugs
mailing list