Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!topaz!think!nike!ucbcad!ucbvax!sdcsvax!sdchem!tps From: tps@sdchem.UUCP (Tom Stockfisch) Newsgroups: net.lang.c Subject: Re: Shift by negative quantity Message-ID: <252@sdchema.sdchem.UUCP> Date: Tue, 8-Jul-86 12:23:12 EDT Article-I.D.: sdchema.252 Posted: Tue Jul 8 12:23:12 1986 Date-Received: Wed, 9-Jul-86 03:28:29 EDT References: <894@bu-cs.UUCP> Reply-To: tps@sdchema.UUCP (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 20 In article <894@bu-cs.UUCP> bzs@bu-cs.UUCP (Barry Shein) writes: >Question: Is shifting by a negative quantity defined (that is, >probably means the other shift.) I could find no mention in K&R. >... Looking up "shift operators" in the index of K&R, I am referred to p. 189: "The result [of a shift operator] is undefined if the right operand is negative, or greater than or equal to the length of the object in bits." I'm sure its done this way so that the operation is closer to every machine's instruction set and isn't a higher-level operation with additional checks or conversions. >P.S. Is this one of those questions that gets asked every 2 months? I haven't seen it before. --Tom Stockfisch, UCSD Chemistry