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

Re: [PATCH] Builtins and C++ and such (take 3)


Roger Sayle <roger@eyesopen.com> writes:

[...]

| I think I also know why I hadn't seen the regressions earlier.  My
| first patch to cmath didn't reorder the double case for std::abs.
| See http://gcc.gnu.org/ml/gcc/gcc-patches/2002-03/msg/msg01513.html
| So the other moral of this affair is that cmath should probably also
| contain the prototype "int abs(int);"

>From a non-implementation details point of view, I argued while ago
(on the committee reflectors) about moving int abs(int) into <cmath>
but got no postive response.  Maybe it is time to ping the committee about
that issue.

It makes the following highly non-deterministic 

   #include <math.h>
   #include <iostream>

   void f(int) { std::cout << "int" << std::endl; }
   void f(double) { std::cout << "double" << std::endl; }

   int main()
   {
      f(std::abs(1));
      f(std::abs(1.0));
   }

There is no reason, the above should be non-deterministic.


-- Gaby


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