This is the mail archive of the
mailing list for the GCC project.
Re: abs(long long)
On Tue, 2 Oct 2012, Gabriel Dos Reis wrote:
On Tue, Oct 2, 2012 at 3:57 AM, Marc Glisse <email@example.com> wrote:
here is the patch from PR54686. Several notes:
* I'll have to ask experts if std::abs(unsigned) (yes, a weird thing to do,
but still) is meant to return a double...
don't we have a core issue about preferring unsigned -> long or long long?
Here I am talking of a library issue: the wording that says that there are
sufficient overloads such that integer types call the double version of
math functions. It is fairly obvious that it doesn't apply to abs(long)
for instance which has an explicit overload. For short or unsigned, I
still read it as saying that it converts to double...
* I still don't like the configure-time _GLIBCXX_USE_INT128, I think it
should use defined(__SIZEOF_INT128__), which would help other compilers.
Why would that be a problem with the appropriate #define?
The library installed by the system was compiled with g++, and is then
used with clang++. If we can avoid installing 2 config.h files to make
* newlib has llabs, according to the doc. It would be good to know what
newlib is missing for libstdc++ to detect it as C99-ready.
I tested a previous version (without __STRICT_ANSI__) on x86_64-linux-gnu
and Oleg Endo did a basic check on sh/newlib. I'll do a last check after the
review (no point if the patch needs changing again).
In general, I think I have a bias toward using compiler intrinsics,
for which the
compiler already has lot of knowledge about.
More precisely, does that mean you want __builtin_llabs instead of
::llabs? I thought the compiler knew they were the same.