Helmut Jarausch
2009-03-23 23:17:27 UTC
Hi
I cannot find documentation whether
#include <cmath>
using std::abs;
int main() {
int N;
return abs(N);
}
should compile or not.
Currently, gcc-4.3.3 signals an ambiguous overload problem:
absT.C: In function 'int main()':
absT.C:6: error: call of overloaded 'abs(int&)' is ambiguous
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/cmath:107: note: candidates are: long double std::abs(long double)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/cmath:103: note: float std::abs(float)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/cmath:99: note: double std::abs(double)
Is this a bug in gcc-4.3.3 or is it conforming to the standard.
It the latter, how to use 'abs' for all numeric types?
Thanks for a hint,
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
I cannot find documentation whether
#include <cmath>
using std::abs;
int main() {
int N;
return abs(N);
}
should compile or not.
Currently, gcc-4.3.3 signals an ambiguous overload problem:
absT.C: In function 'int main()':
absT.C:6: error: call of overloaded 'abs(int&)' is ambiguous
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/cmath:107: note: candidates are: long double std::abs(long double)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/cmath:103: note: float std::abs(float)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/cmath:99: note: double std::abs(double)
Is this a bug in gcc-4.3.3 or is it conforming to the standard.
It the latter, how to use 'abs' for all numeric types?
Thanks for a hint,
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]