This is the mail archive of the gcc-bugs@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]

Re: namespace std


> using egcs-1.1a, I can't get the declarations in <math.h> into
> namespace std even if using -fhonor-std

This is because g++ has builtin definitions of the math.h functions in
::. When I compile

namespace std{
#include <math.h>
}

main()
{
  sqrt(9.0);
}

with

g++ -fhonor-std -fno-builtin d.cc -o d

I get

d.cc: In function `int main()':
d.cc:7: warning: implicit declaration of function `int sqrt(...)'

When I compile

namespace std{
#include <math.h>
}

main()
{
  std::sqrt(9.0);
}

instead, it compiles. The real fix, of course, is that the builtin
functions should be in std:: if it is honored. Thanks for your report.

Hope this helps,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]