[net.unix-wizards] The size of pointers

alex (12/08/82)

The reason that ints should be as large as pointers has to do with
the semantics of the following perfectly legal C expression:

char *pointer1 = VeryHighAddress;
char *pointer2 = VeryLowAddress;

	pointer1 - pointer2

According to the semantics of C, pointer subtraction yields an INTEGER which
is the scaled difference of the objects, in other words, the number of
objects between the two pointers.  Last I checked, a very large 32 bit
quanitity minus a very small 32 bit quantity can easily be much bigger than
what is representable in 16 bits.  As long as all versions of C have a long
int which is as big as (char *) there is no real problem.

					Alexis Layton
					Computer Corporation of America
					alex@CCA-UNIX
					decvax!cca!alex

P.S.  Shouldn't most of this discussion have been in net.lang.c?  Or is
the problem in the Arpanet side?