stdlib.h abs(long) overload?
Marc Glisse
marc.glisse@inria.fr
Mon Mar 3 20:57:00 GMT 2014
On Mon, 3 Mar 2014, Stephan Bergmann wrote:
> I discovered that at least with Fedora 20 combination of libstdc++ 4.8.2 and
> glibc 2.18, including stdlib.h does not make available an abs(long) overload
> to abs(int).
And more generally we don't add anything to the C headers.
> It works correctly when using cstdlib and std::abs instead, and my reading of
> the C++ standards (both 03 and 11) is that including stdlib.h should make the
> overload available in the global namespace.
Yes, there are several PRs in bugzilla about that.
> The __CORRECT_ISO_CPP_STDLIB_H_PROTO in the source (apparently only used for
> Solaris) makes me assume that this is a known issue. Is the take of
> libstdc++ on this that it is a bug in glibc that needs to be fixed there?
Solaris has cool headers, but nothing prevents glibc from imitating them,
it already has some C++ extras (__CORRECT_ISO_CPP_STRING_H_PROTO).
> (Not sure whether the alternative of working around the glibc shortcoming in
> libstdc++, by providing a stdlib.h wrapper, say, would be feasible at all.)
Yes, it should be rather straightforward for most headers, and it is
needed for all the platforms that provide C-only headers, it's just that
nobody was motivated enough.
--
Marc Glisse
More information about the Libstdc++
mailing list