Pointer -> Long Conversion
Alan S. Driscoll
alan at allegra.UUCP
Thu Jul 26 03:41:59 AEST 1984
> This discussion of sign extending pointers when converting to longs
> has got me wondering what the Prime C compiler does when extending a
> long into a pointer. Pointers are the longest type on this compiler:
> 48 bits, while long, int, and unsigned are all 32 bits. This breaks
> all programs that assume pointers can be assigned to longs and recovered
> unchanged. Only char pointers need more than 32 bits, but the compiler
> author decided to make all pointers 48 bits anyway. I'll investigate
> this and report back if anyone is interested.
If this is the case, then the Prime compiler is just wrong. See section
14.4 of the C Reference Manual, "Explicit pointer conversions." At least
one of the integral types must be large enough to hold a pointer.
--
Alan S. Driscoll
AT&T Bell Laboratories
More information about the Comp.lang.c
mailing list