Path: utzoo!attcan!uunet!steinmetz!davidsen From: davidsen@steinmetz.ge.com (William E. Davidsen Jr) Newsgroups: comp.lang.c Subject: Re: Shifting question Message-ID: <11592@steinmetz.ge.com> Date: 20 Jul 88 15:01:01 GMT References: <705@bnr-rsc.UUCP> <11556@steinmetz.ge.com> <60290@sun.uucp> <1818@spar.SPAR.SLB.COM> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric CRD, Schenectady, NY Lines: 19 In article <1818@spar.SPAR.SLB.COM> hunt@spar.UUCP (Neil Hunt) writes: | In article <60290@sun.uucp> guy@gorodish.Sun.COM (Guy Harris) writes: | >ANSI C: | > 3.3.7 Bitwise shift operators | > ...If the value of the right operand is negative or is greater than or | > equal to the width in bits of the promoted left operand, the behavior | > is undefined. | So you have to build in an explicit check in every program, comparing the shift with the size of the item. On the other hand it sure makes the compilers look better, since no error checking means faster benchmarks to advertize. If I sound really disgusted about this, I am. Compilers on brain damaged hardware should work correctly. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me