Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!brl-adm!umd5!mimsy!chris From: chris@mimsy.UUCP Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: What's Wrong here? Message-ID: <9612@mimsy.UUCP> Date: Thu, 3-Dec-87 21:28:51 EST Article-I.D.: mimsy.9612 Posted: Thu Dec 3 21:28:51 1987 Date-Received: Sun, 6-Dec-87 20:22:19 EST References: <278@westmark.UUCP> <6755@brl-smoke.ARPA> <6855@sunybcs.UUCP> <314@etn-rad.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 41 Xref: utgpu comp.lang.c:5398 comp.sys.ibm.pc:9204 In article <314@etn-rad.UUCP> jru@etn-rad.UUCP (John Unekis) writes: >The discussion was not of MOST computers, it was regarding the Intel >80?86, and I specifically referenced Microsoft C, which does use the >arithmetic shift for right shifting integers. The discussion was neither `of most computers' nor `regarding the Intel 80?86': the discussion started with a question about the language C, in which the type of right shift for signed integers is left unspecified (at least in K&R). It was placed in a context which referenced Microsoft C, but the question itself was more generic. Never assume that mere mention of one particular means that those reading your article will view it as being restricted to that particular. To John Woods, who flamed Fai Lau for flaming Doug Gwyn: Please do not be *too* harsh. Fai Lau's point (which I regard as being `by observing the results of various technically-undefined operations, one can determine, to some extent, the inner workings of one's system') is valid. It is unfortunate that he had obscured that point with incorrect `facts' and confusing wording. I seem to be good at left-handed compliments! Perhaps it is because I am left handed. :-) At any rate, can we stop this discussion, now that we have settled upon the following: In C as it is currently defined (K&R), - the result of left shifting an `int' value by 31 bits is undefined - the result of subtracting 1 from the most negative `int' value a system can represent is undefined - whether right shift is arithmetic or logical is undefined In MS C for the IBM PC, - the `most negative' `int' value is -32768 - right shift of a signed integer quantity is done with an arithmetic (sign-preserving) shift - right shift of an unsigned integer quantity is done with a logical (zero-filling) shift -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris