Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: subtraction between unsigned ints Message-ID: <10996@smoke.BRL.MIL> Date: 9 Sep 89 01:26:51 GMT References: <12570023@hpclwjm.HP.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <12570023@hpclwjm.HP.COM> walter@hpclwjm.HP.COM (Walter Murray) writes: -Doug Gwyn writes: ->In article kuro@shochu.Sun.Com (Teruhiko Kurosaka - Sun Intercon) writes: ->>Does pANSI defines the datatype of the result of subtraction ->>between unsigned integers? Would it be also unsigned? ->Yes, the type of the result of any arithmetic combination of operands ->having a single arithmetic type is the same type as that of the operands. -But note that the usual arithmetic conversions are still performed. -So if s1 and s2 have type short int, for example, the expression -(s1+s2) has type int, not short int. Yes, I was trying to put it succinctly. What I described was strictly accurate only for arithmetic types that don't undergo the usual arithmetic conversions when combined with other operands of their own type. Unsigned int is one of those.