This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Builtins and C++ and such (take 3)
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Benjamin Kosnik <bkoz at redhat dot com>, Mark Mitchell <mark at codesourcery dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: 01 Apr 2002 17:30:40 +0200
- Subject: Re: [PATCH] Builtins and C++ and such (take 3)
- Organization: CodeSourcery, LLC
- References: <Pine.LNX.4.33.0204010823480.26276-100000@www.eyesopen.com>
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