This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: abs(int) missing
Steven King wrote:
>
> On Thu, 17 Aug 2000, Levente Farkas wrote:
>
> >
> > #include <cmath>
> > #include <cstdlib>
> > int main()
> > {
> > int i = std::abs(4);
> > return 0;
> > }
> >
> > g++ -fhonor-std test.cpp
> > test.cpp: In function `int main ()':
> > test.cpp:5: call of overloaded `abs (int)' is ambiguous
> > /usr/include/g++-v3/bits/std_cmath.h:52: candidates are: float std::abs (float)
> > /usr/include/g++-v3/bits/std_cmath.h:262: double std::abs
> > (double)
> > /usr/include/g++-v3/bits/std_cmath.h:362: long double std::abs
> > (long double)
>
> My apologies. If you use the shadow headers, the ones I patched some
> months ago, it should work (or atleast it does for me)
this means that you can compile the above code ???
my compiled and used gcc (and libstdc++ is not the latest 2.96 20000724),
but I've got the latest cvs and I compare :
cstdlib
bits/std_cstdlib.h
shadow/stdlib.h
and these files are identical. so what else can be the problem ?
anyways the stdlib.h from glibc contain abs(int) but not abs(long) (just
labs(long)) who these function get into std ? the above three files
just include themself and the original stdlib.h (and move those functions
to the global namespace (???)).
-- Levente
"The only thing worse than not knowing the truth is
ruining the bliss of ignorance."