ints vs. pointers
John Mackin
john at physiol.OZ
Thu Nov 15 15:20:29 AEST 1984
I can remain silent no longer. In the debate about NULL vs non-NULL,
people seem to be overlooking the fact that the number of actual "data"
bits (as opposed to "noise" bits such as object size, etc., used on
some CPUs) in a pointer MUST BE no bigger than the number of bits in an int!
[Before the flames start I KNOW K&R's not a standard but it's the closest
we've got.] I refer you to Appendix A, para 7.4 (page 189 in my edition):
If two pointers of the same type are subtracted, the result is con-
verted (by division by the length of the object) to an int representing
the number of objects separating the pointed-to objects.
This is clearly not necessarily possible if you have (say) 32-bit pointers
(with ALL 32 bits being address) and 16-bit ints.
John Mackin, Physiology Department, University of Sydney, Sydney, Australia
...!decvax!mulga!john.physiol.su
More information about the Comp.lang.c
mailing list