Re: 2.4.0-test10-pre6: Use of abs()

Martin Dalecki
2000-11-02T11:21:26Z

Richard Henderson wrote:
>
> On Wed, Nov 01, 2000 at 09:46:19AM -0500, tytso@mit.edu wrote:
> > What versions of gcc produce the built-in functions?
>
> 2.95 and previous. In 2.96 somewhere we fixed a bug that
> automatically prototypes these builtin functions for you;
> ie with current code you get an undeclared function warning.
>
> > And does it do so for *all* platforms? (i.e., PPC, Alpha,
> > IA64, etc., etc., etc.)
>
> Yes. The thing about abs, though, is that it's "int abs(int)"
> which does naughty things with longs on 64-bit targets. You're
> much better off writing (x < 0 ? -x : x) directly.

Thank's for answering it... I was already looking up the GCC source for
an exact answer ;-). However what's the difference in respect of
optimization between unrolling the abs function by hand and
relying on the built in?