Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!ginosko!uunet!kddlab!ccut!titcca!sragwa!wsgw!socslgw!diamond From: diamond@csl.sony.co.jp (Norman Diamond) Newsgroups: comp.std.c Subject: Re: subtraction between unsigned ints Message-ID: <10833@riks.csl.sony.co.jp> Date: 13 Sep 89 10:16:16 GMT References: <12570024@hpclwjm.HP.COM> Reply-To: diamond@ws.sony.junet (Norman Diamond) Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 35 Someone asked: >>>Does pANSI defines the datatype of the result of subtraction >>>between unsigned integers? Would it be also unsigned? Then >>>what would be the result of subtraction of a number from a >>>smaller number? I answered: >>It always has been unsigned, even in K&R days. pANS says that the >>result must wrap around modulo some power of 2; this was not required >>by K&R but surely always occured. In article <12570024@hpclwjm.HP.COM> walter@hpclwjm.HP.COM (Walter Murray) writes: >I think it was required by K&R. See Appendix A, section 6.5, in the >first edition (page 184). That section specifies conversion from [signed] int to unsigned int. It does not specify the result of subtraction. Hmm, this raises a new question. Someone who had the good fortune to receive service from Global Engineering Documents, please kindly answer: Does the standard specify the same conversion as K&R-1 did? Or is this another quiet change? On a 1's complement machine, K&R-1 required more computation than just a move instruction. Do the pants impose the same requirement? -- -- Norman Diamond, Sony Corporation (diamond@ws.sony.junet) The above opinions are inherited by your machine's init process (pid 1), after being disowned and orphaned. However, if you see this at Waterloo or Anterior, then their administrators must have approved of these opinions.