Bug in cmath namespace

Jens Vollinga vollinga@gmx.de
Mon Jan 30 14:23:00 GMT 2006


Hi,

I want to define classes called sin,cos,etc. and include the cmath header at
the same time. I thought this would work since I don't say "using namespace
std;" anywhere. But it seems that by including cmath these functions appear
not only in namespace std, but also in the global namespace. The following
stripped-down program compiles with gcc 3/4, but it shouldn't (according to
the standard, since it doesn't say std::sin):

#include <cmath>

int main()
{
    double x = sin(2.0);
    return 0;
}

I am not really sure whether this is a bug with respect to the ISO standard
or whether I made a mistake here. Does anybody know why gcc/libstc++ behaves
like that?

Jens

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++



More information about the Gcc-help mailing list