Poll: how often do programs have collections sorted/hashed by pointer/reference value?
-
All undefined behaviour should do this.
I like the idea some compilers use of treating that as knowledge that inspires optimization...as long as the compiler says it's doing so. "Oh, you did a mixed signed and unsigned comparison in an if? Since that's undefined behavior, I'll treat the body of the if as unreachable code and not generate anything."
Because then it confronts your nonconforming behavior.
-
That would be OK if they warned about it. Give people a reason to pay attention to warnings. Otherwise, it's purest evil (and would belong in another thread… )