[comp.sys.m68k.pc] C machine

mwm@VIOLET.BERKELEY.EDU (Mike Meyer, My watch has windows) (01/15/88)

>> The result of subtracting two pointers is *defined* (K&R) to yield
>> a result of type int. Not long int - int!  Any implementation that
>> can not represent this in an int is not an implementation of C.

No, the result is *converted* to an int. It doesn't say anything about
the result having to *fit* in an int!

Of course, lots of compilers now days do lots of things that K&R
wouldn't approve of. They're following the dpANS. Which has this to
say on the topic (section 3.3.6):

	When two pointer to members of the same array object are
	subtracted, the difference is .... The size of the result is
	implementation-defined, and it's type (a signed integral type)
	is ptrdiff_t defined in the <stddef.h> header.

In other words, that just isn't so. Not much of a problem on most
machines, though.

	<mike