develooper Front page | perl.perl5.porters | Postings from December 2000

Re: when == isn't (was Re: pp_add -> pp_i_add efficiency hack?)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
December 2, 2000 14:03
Subject:
Re: when == isn't (was Re: pp_add -> pp_i_add efficiency hack?)
Message ID:
20001202220337.A10600@plum.flirble.org
On Sat, Dec 02, 2000 at 03:46:30PM -0600, Jarkko Hietaniemi wrote:

> In alpha where sizeof(long long) == sizeof(long) == sizeof(double) == 8:
> 
> imprecision=18446744073709552000.0      max=lu
> imprecision == (double) max

                                              ^ eh?
> You can see how the low order bits fade into garbage...

so both == aren't true? good.

> (btw, fwiw, long long is still thought to be a non std language extension,
>  so in the actual test we should use UV)

I was doing so. It's just clearer for the test case to use the compiler's
types.

As I have been taught by rote by someone who likes ANSI C,
   long long breaks utterly the commitment that ANSI C (1989) makes that
   long is the longest integer type.
and therefore should never be allowed to exist.
   (He's an idealist. His opinion is that if you need 64 bits define a new
    ABI where sizeof int is 4, sizeof long is 8. If your programs break at
    this point, then fix 'em. They're making unwarranted assumptions and are
    not portable)

[OK, I'm not asking to be told how many programmer years of toil it would take
to recode all programs to cope with sizeof long increasing, versus just
defining long long to be longer than long. We both realise that's why long
long exists]

is it safe to assume that the macros Strtol and Strtoul point to long long
versions if IV/UV are long long?

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About