News for hackers. Stuff that matters.
Re:Catch-23: The New C Standard Sets the World on Fire by c4mpute on Sunday April 02, 2023 @06:49AM (#35409193)
> all you have to do to avoid UB on signed integer overflow is check for overflow before doing the operation

All you have to do is add a check for overflow _that the compiler will not throw away because "UB won't happen"_. The very thing you want to avoid makes avoiding it very hard, and lots of bugs have resulted from compilers "optimizing" away such overflow checks.

Re:Catch-23: The New C Standard Sets the World on Fire by chongli on Sunday April 02, 2023 @03:54PM (#35414442)
This is covered in the article and numerous replies in this thread. Use <stdckdint.h>.
Re:Catch-23: The New C Standard Sets the World on Fire by c4mpute on Wednesday April 05, 2023 @07:08PM (#35461742)
stdckdint.h is only available in C23. The problem has existed before that and lead to tons of exploits and bugs.