Comment by flohofwoe

10 hours ago

It would already help a lot when the C and C++ standards start to clean up the list of Undefined Behaviour (e.g. there's a lot of nonsense UB currently in the C standard which could easily become Defined Behaviour - like the "file doesn't end in a new-line character" thing):

https://gist.github.com/Earnestly/7c903f481ff9d29a3dd1

The easy cases like you cite are also those that don’t cause problems in practice. I’m not sure that would help all that much, other than to slightly reduce internet criticism.

  • Fixing easy cases makes the list shorter, so enables more focus on harder cases.

    And it also signals that you actually do want to improve, just a little bit of boy scout rule goes a long way.

    • The issue is that the list is infinite (anything not specified is UB), so actually removing any finite amount of UB from the list won't make it shorter.

      (only slightly tongue-in-cheek, I do believe that removing silly things is worthwhile).

      4 replies →