Path: utzoo!attcan!uunet!husc6!cmcl2!nrl-cmf!ames!ncar!gatech!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.lang.c Subject: Re: signed/unsigned char/short/int/long [was: #defines with parameters] Message-ID: <10897@ulysses.homer.nj.att.com> Date: 28 Nov 88 21:42:39 GMT References: <264@aber-cs.UUCP> <8982@smoke.BRL.MIL> <8983@smoke.BRL.MIL> <277@aber-cs.UUCP> Sender: netnews@ulysses.homer.nj.att.com Reply-To: jss@hector.UUCP (Jerry Schwarz) Distribution: eunet,world Organization: AT&T Bell Laboratories Lines: 25 In article <277@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) makes some groundless attacks on the ANSI commitee apparently due to misunderstanding the (proposed) standard. I respond to one case in which either he or I have clearly misunderstood something. > >Using this interpretation, there is little argument about adopting a >"[un]signed preserving" or "value preserving" rule; the only rules are >that conversion from a shorter to a long form of the same type results >in no changes, and tyhe same applies when a longer value is shortened >to a length that can represent it, and conversion across the two base >types is defined only if the source unsigned is not too large or the >source int is not too large or negative; anything else is machine >dependent, except that truncations to a length of unsigned must respect >the rules of modular arithmetic. This is pretty much what the standard says about conversions, but it in no way resolves the difference between the "value preserving" and "unsigned preserving" rules. These address a different question. Namely the types of certain expressions. For example what is the type of i+us (where i is an int, and us is an unsigned short). Jerry Schwarz AT&T Bell Labs, Murray Hill