[comp.lang.c] Should conversion from pointers to integers be a functional mapping?

norvell@csri.toronto.edu (Theodore Stevens Norvell) (05/28/89)

I know that K&R state that conversion from pointer types to integral types
is implementation defined.  However in most implementations the mapping is
functional (that is, if p and q are pointers and p==q, then (long)p==(long)q).

I am writing a C compiler for machines (CDC's Cyber 180 and Cyber 900) where
this is not a natural property.  Making conversions functional would cost
some time on each conversion and has some nasty consequences for interlanguage
calls that I'd rather not get into.  What I need to know is whether there is a
significant body of code that depends on the functionality of this
mapping.  For example, code that hashes pointer values would depend on it.
Note that it is easy for the user to write his code such that the mapping
is functional by masking off the most significant bits.

Any comments will be appreciated.

Thanks in advance,
Theodore Norvell

norvell@csri.toronto.edu