🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.m68k.pc
Article #170

Re: C machine

#170
From: Mike Meyer, My watch has windows
Date: Thu, 14 Jan 1988 23:51
21 lines
1258 bytes
>> 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
	
Technical Details
Message-ID: <8801142352.AA23658@violet.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!ucbcad!pasteur!ucbvax!VIOLET.BERKELEY.EDU!mwm

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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