Shifting question

William E. Davidsen Jr davidsen at steinmetz.ge.com
Thu Jul 21 01:01:01 AEST 1988


In article <1818 at spar.SPAR.SLB.COM> hunt at spar.UUCP (Neil Hunt) writes:
| In article <60290 at sun.uucp> guy at 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 at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list