Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ah, you're right.

  > If the value of the right operand is negative
  > or is greater than or equal to the width of
  > the promoted left operand, the behavior is
  > undefined"
(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1570.pdf - ISO/IEC 9899:201x (C11 Working Draft N1570): 6.5.7 Bitwise shift operators)


Yeah. It seems like something easy to define to me, at least in the case the compiler can recognize the shift is a constant. But that's the standard for you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: