News for hackers. Stuff that matters.
Re:GCC undefined behaviors are getting wild by eru on Monday November 28, 2022 @05:59AM (#33772078)
> And "defining" it is a lame approach to safety. If you make it wraparound, you now have silent wraparounds that can't be found by static analysis. You want unintended overflows to trap, not just be defined.

Yes. But even the lame approach is better than UB, because it doesn't bring the whole program down.

Re:GCC undefined behaviors are getting wild by Gibbon1 on Tuesday November 29, 2022 @04:53PM (#33793886)
I've been wondering if I should mention that using int for an index is a bad idea because the standard only guarantees it's 16 bits. You should use size_t instead. And in C size_t is unsigned.

My take is all of the low hanging fruit optimizations that the standard enables has been picked a long time ago. Everything left is problematic.