At 03:57 PM 9/5/00 -0400, Hookway, Ray wrote:
>In my environment (Tru64 on Compaq Alpha) I32 is an int and IV is a long.
>This means that the following example (from 'Adbvanced Perl' fails:
[Snip]
>The problem is that the cast to I32 truncates the 64 bit pointer to 32 bits.
>It also contradicts the statement (also in 'Advanced Perl') that:
>
>"All the tables in this chapter make use of two important typedefs, I32 and
>U32, which represent signed and unsigned integral quantities that are at
>least 32 bits wide and big enough to hold a pointer (it will be 64 bits on a
>64-bit machine)."
Advanced Perl is wrong here. I32 (and U32) are supposed to be 32-bit
quantites.
>perlguts, on the other hand, seems to imply that an IV is quaranteed to be
>big enough to hold a pointer, but the only qurantee about I32 is that it is
>at least 32 bits.
>So, what's the deal? Should I32 be big enough to hold a pointer or not?
I32's not safe to put pointers in. Code should really use IV.
More strongly, you shouldn't ever use the (I|U)(8|16|32|64) constants
unless you want things of exactly that size. For generic signed and
unsigned ints, use IV or UV, respectively.
For code that builds in for 5.6.0, you should also use NV for floating
point values. (That typedef's not there for 5.005_03 and before, alas)
It'll be whatever perl's using to hold a float. (Which might be "long
double" if someone's chosen extended floating-point support)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk