This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Bug in cmath namespace
- From: "Jens Vollinga" <vollinga at gmx dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 30 Jan 2006 15:23:46 +0100 (MET)
- Subject: 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 +++