3 ms·
I think it's quite obvious strict aliasing is implied in this case. The bug is than even with strict aliasing he should get the result he wants, because the las
by Too 11y ago
I think it's quite obvious strict aliasing is implied in this case. The bug is than even with strict aliasing he should get the result he wants, because the last time he wrote to the pointer before reading it as an int he wrote it as an int and hence it should keep the int-value 1.
Having that said, balancing aliasing like this is just asking for trouble, don't try this at home.
EDIT: The more i look at it the more i think he is wrong. Since pi and pd shouldn't be able to alias, the last assignment to both of them is allowed to reorder. This is just UB.