This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in cmath namespace


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]