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
Jarkko Hietaniemi
December 2, 2000 15:59
Re: when == isn't (was Re: pp_add -> pp_i_add efficiency hack?)
Message ID:
On Sat, Dec 02, 2000 at 10:03:38PM +0000, Nicholas Clark wrote:
> 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?

'%llu' !~ /ANSI C/ # :-)

With %lu:

imprecision=18446744073709552000.0      max=18446744073709551615
imprecision == (double) max

> > 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

That is exactly what Digital did with Alpha :-)

>     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]

I do not understand that argument since it adding long long only
*adds* the amount of broken code, both in absolute and in relative terms.

But that's not a problem for us to fix.  Configure divines IV and UV
for us and that's what we should use.

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

Yes.  If it is not safe we fix them until they are safe.

> Nicholas Clark

$jhi++; #
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About