Bug in cmath namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 +++

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux