subtracting two pointers

bukys at rochester.UUCP bukys at rochester.UUCP
Wed Jan 25 00:27:18 AEST 1984


One possible outcome of this "difference of two pointers can't fit in
an int or even a long int" debate is that the difference will be
defined to be implementation-dependent (close to undefined, except that
op sys hackers can know what's going on) if the pointers do not
reference elements of the same array.  Maybe any array will be limited
to having at most MAXINT elements.

In fact, I will go so far as to claim that this definition is already
the case.  Consider a compiler for a segmented-memory machine where
each array is in a different segment.  Subtraction of {pointers into
two different segments} is meaningless.

There, ANSI-C-standardizers: a clean and simple solution.

Liudvikas Bukys
rochester!bukys (uucp) via allegra, decvax, seismo
bukys at rochester (arpa)



More information about the Comp.lang.c mailing list