3 ms·
A bit pointless example, because that "int y..." is going to be pruned away anyways, since the result is not used anywhere. Hence it won't trigger any undefine
by vardump 4y ago
A bit pointless example, because that "int y..." is going to be pruned away anyways, since the result is not used anywhere.
Hence it won't trigger any undefined behavior.
- rocqua 4y agoThe program still contains undefined behavior. It is probably a matter of order of optimization whether the compiler catches the undefined behavior before it elides the useless statement. But it is certainly 'legal' for the compiler to consider that statement to invoke undefined behavior, and prune any branch that is guaranteed to reach that statement.