Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!ucbcad!pasteur!ucbvax!VIOLET.BERKELEY.EDU!mwm From: mwm@VIOLET.BERKELEY.EDU (Mike Meyer, My watch has windows) Newsgroups: comp.sys.m68k.pc Subject: Re: C machine Message-ID: <8801142352.AA23658@violet.berkeley.edu> Date: 14 Jan 88 23:51:43 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 21 Approved: info-68k@ucbvax.berkeley.edu >> 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 header. In other words, that just isn't so. Not much of a problem on most machines, though.