Pointer -> Long Conversion

Clay Phipps phipps at fortune.UUCP
Sat Jul 21 08:28:13 AEST 1984


Whether pointers should be sign-extended or not depends on the architecture
of the host machine.

Addresses in the ELXSI 6400 are *signed* 32-bit integers.
Therefore, they should be sign-extended when converted to 64-bit "long",
so that they retain their integral value in both sizes.

Although signed addresses are unconventional,
it turns out that they cause no problems whatsoever,
and they removed the need to perform 32-bit unsigned arithmetic
as a special case within the machine for address calculation.

If minus signs on addresses bother you, just print addresses in hexadecimal
(or octal, if you're an octopus :-), and you won't see them at all.

-- Clay Phipps

-- 
            { amd  hplabs!hpda  sri-unix  ucbvax!amd }          
                                                      !fortune!phipps
   { ihnp4  cbosgd  decvax!decwrl!amd  harpo  allegra}



More information about the Comp.lang.c mailing list