News for hackers. Stuff that matters.
Re:Integers in C quiz by codeflo on Sunday September 04, 2022 @12:44PM (#32714920)
That’s true, I’d add something more. Your reasoning about hardware differences would only justify implementation-defined behavior, not undefined behavior. The distinction is important here: undefined behavior is when the compiler can make surprising optimizations in other parts of the code assuming something doesn’t happen.
Re:Integers in C quiz by jcranmer on Sunday September 04, 2022 @12:59PM (#32715124)
I imagine the reason oversized shifts are UB is because some 40-year-old computer hardware trapped on oversized shifts, as traps are always UB in C.