News for hackers. Stuff that matters.
Re:Summary of C/C++ integer rules by UncleMeat on Friday April 02, 2021 @12:29PM (#26672935)
But "unsigned" doesn't actually enforce the semantics you want. Missing an overflow check means your value will never be negative, but it is almost certainly still a bug. And because unsigned overflow is defined, the compiler isn't allowed to prevent you from doing it!

This is just enough type semantics to injure oneself.

Re:Summary of C/C++ integer rules by dkersten on Friday April 02, 2021 @01:22PM (#26673561)
So, because its not perfect, should you throw it all out?
Re:Summary of C/C++ integer rules by UncleMeat on Friday April 02, 2021 @07:42PM (#26677057)
No. Because people tend to make more mistakes if they try to use unsigned values in this manner in C/C++.
Re:Summary of C/C++ integer rules by dkersten on Saturday April 03, 2021 @09:02AM (#26680724)
I’ve personally never encountered a bug that turned out to be caused by an unsigned value. YMMV, I guess.
Re:Summary of C/C++ integer rules by UncleMeat on Saturday April 03, 2021 @12:22PM (#26682261)
If seen all sorts of bugs caused by surprise conversions, as well as overflows that cause bugs that would be statically detectable but can't become blocking errors because unsigned overflow is well defined.