Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • This is, IMHO, the dumbest UB spec in C. Too bad people keep discovering it the hard way... Commented Jun 15 at 4:25
  • 2
    @Dúthomhas: The problem is that CPU architectures vary in the behavior of their shift instructions. On x86 for instance, getting mathematically correct behavior for shifts would require several additional instructions, and make every non-constant shift operation several times more expensive - even if all your shifts are actually within range. This runs counter to "pay for what you use". Commented Jun 15 at 18:54