3 ms·
> is of the opinion that you should check your compiler's behavior rather than read standards Do both. Disassemble your compiler's output to see what horrors
by MaulingMonkey 10y ago
> is of the opinion that you should check your compiler's behavior rather than read standards
Do both.
Disassemble your compiler's output to see what horrors the optimizer inflicted on your code to "break" it. Read the standard to understand why it thought it was an okay optimization to do in your case, to avoid running afoul of the same mistake again. Ask what other optimizations are enabled by this undefined behavior, the better to spot them when the code your coworker's former boss's roomate, who interned for a month or two, invokes undefined behavior.
Repeat.
(To be fair, I haven't read the standards cover to cover - perhaps I should, I'm still occasionally learning about new and exciting forms of UB...)