3 ms·
Well, sort of. The problem is that it's not up to you what counts as reasonable. As you observed stuff will get pretty crazy if the actual machine code executed
by tialaramex 3y ago
Well, sort of. The problem is that it's not up to you what counts as reasonable. As you observed stuff will get pretty crazy if the actual machine code executed tries to do floating point arithmetic on integer values for example. Because of the ODR C++ washes its hands of responsibility, no matter why it happened (e.g. re-used the name of a macro, forgot to use a dummy do-while loop) the ODR itself means that's not a C++ program so it's not their problem. You are not entitled to an error. Some tools might make best efforts to report ODR violations but they are all fallible.
The compilers aren't intentionally breaking your code, but they have no responsibility for what happens once you break the rules. I care about Correctness too much for this to be acceptable. If I wrote 100 programs and ten are faulty, I'd rather have twenty errors, half of which are false positives and half catch my ten mistakes, than five errors and five of the "working" programs compile but have mysterious bugs because they're faulty.