Why does using 64-bit constants on a 64-bit build of Perl issue the warning: Hexadecimal number > 0xffffffff non-portable ...?

We don't get warnings that using /path/to/something is non-portable to Windows. Or vice versa.

We don't get warnings that getgrgid or setpwent are non-portable. Just a The getgrgid function is unimplemented ... on those platforms that don't support it.

So why warn of of the non-portability of 64-bit constants on 64-bit platforms (where they work just fine)?

Wouldn't it be better to warn or die only when >32-bit constants are used on 32-bit platforms?

Or at least make it a warning that has to be enabled, rather than disabled.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re: Non-portable warnings.
by ikegami (Patriarch) on Jun 16, 2010 at 18:38 UTC

    I'd rather see >32-bit hex constants croak or warn ("overflow") on a 32-bit platform than warn on a 64-bit platform.

    Update: Turns out it already warns "Integer overflow in hexadecimal number" on 32-bit platforms.

Re: Non-portable warnings.
by JavaFan (Canon) on Jun 16, 2010 at 14:21 UTC
    My guess, some p5p person once got bitten by this, and, having its pride hurt, decided it's an outrage perl doesn't protect him from making mistakes - it's better to annoy lots of people than have a single p5p making a mistake. He then supplied a patch, and for some reason, this got accepted.

    Luckily, most suggestions for even more warnings never make it all the way into a release. But some do.

    Having said that, I do not think this kind of non-portability is quite the same as the Windows vs. non-Windows non-portability. The latter would actually require someone to take the program, and move it to a different platform. The 64-bit vs 32-bit issue can happen because the perl used on the box was replaced.

    But I think it's a stupid warning.

Re: Non-portable warnings.
by ambrus (Abbot) on Jun 16, 2010 at 14:59 UTC

    OT: the title of your code reminds me to can someone help me?, but that's of course another meaning of "non-portable warnings".

Re: Non-portable warnings.
by salva (Canon) on Jun 16, 2010 at 15:29 UTC
    Wouldn't it be better to warn or die only when >32-bit constants are used on 32-bit platforms?
    Or make 32 bits perl handle hex numbers bigger than 0xffffffff in the same way it handles them when given in base ten.

    NVs can hold integers up to 2**48 on most (all?) platforms.

      I don't know where you got your number. IEEE doubles can hold integers from -253 to 253 (inclusive) with no loss of precision.
        oops, sorry, my memory betrayed me!