3 ms·
You're right that it's UB, good point. It's hard to think what a sane compiler would do in this case besides going through with the dereference, though.
by pbsd 13y ago
You're right that it's UB, good point. It's hard to think what a sane compiler would do in this case besides going through with the dereference, though.
- dbaupp 13y agoA pointer dereference allows the compiler to assume that a pointer is non-NULL, so it can then perform "invalid" optimisations (like dead-code removal), this post contains an very small example: http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html http://blog.llvm.org/2011/05/what-every-c-programmer-should-...