Path: utzoo!utgpu!attcan!uunet!husc6!mailrus!cornell!uw-beaver!fluke!ssc-vax!cxsea!blm From: blm@cxsea.UUCP (Brian Matthews) Newsgroups: comp.lang.c Subject: Re: question about shift operator Message-ID: <2553@cxsea.UUCP> Date: 2 Nov 88 21:11:57 GMT References: <786@gtx.com> Reply-To: blm@cxsea.UUCP (Brian Matthews) Distribution: na Organization: Computer X Inc. Lines: 19 Randy D. Miller (randy@gtx.UUCP) writes: |I've seen conflicting information about the shift operator in cases |where operand2 is exactly equal to the number of bits in the object. |E.g., with a 32 bit int, what must the following do? | int n; | n <<= 32; |K&R 1st ed. seems to indicate the operation is undefined, but does |the proposed standard change this? From section 3.3.7 "Bitwise shift operators" of the ANSI draft standard, in the first paragraph under Semantics: "...If the value of the right operand is negative or greater than or equal to the width in bits of the promoted left operand, the behavior is undefined." -- Brian L. Matthews blm@cxsea.UUCP ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm +1 206 251 6811 Computer X Inc. - a division of Motorola New Enterprises