in reply to Re: Perl and 64-bit compilers
in thread Perl and 64-bit compilers

I therefore leap to the conclusion that length(pack("i")) will give me the same as $Config{intsize}.

If that's the case, then I find it a little confusing that 'perldoc -f pack' tells me that the 'int' may be even larger than the 'long', yet %Config is telling me that it's smaller (wrt the particular Linux x86_64 box in question - to which I don't have direct access, btw).

Thanks for alerting me to the alternative.

Cheers,
Rob

Replies are listed 'Best First'.
Re^3: Perl and 64-bit compilers
by ambrus (Abbot) on Feb 18, 2007 at 15:12 UTC

    I think you misunderstand what pack tells you. Look. The pack templates are:

    i - native C int l - always 32 bits (nicknamed "long") l! - native C long
    The native long is always at least as large as the native int. The native int could potentially be larger then 32 bits. On typical systems, however, an int is 32 bits long and long is either 32 or 64 bits.
      I think you misunderstand what pack tells you

      Yes ... I think you may be right. On re-reading I see that it is possibly telling me simply that an int might be greater than 32 bits. It sort of depends on whether the "long" that is "described in the next section" is the "long" that "is _exactly_ 32 bits" or the "long" that is according to the "local C compiler" :-)

      Anyway, simplest thing is probably for me to fire off an email to the guy that has this machine and just verify that sizeof(int) == 4. (Sorry ... maybe that's what I should've done in the first place. I'll send another post to this thread when he replies with the answer.) If he can confirm that sizeof(int) is in fact 4, then I think we can be satisfied that %Config is doing its job properly.

      Thanks ambrus, liverpole.

      Cheers,
      Rob
        maybe that's what I should've done in the first place

        Yep .... that's what I shoulder done.

        My friend (with the linux x86_64 box) confirms that %Config gets it right.

        Cheers,
        Rob