5 ms·
When compiled with -O3 using g++ it returns 0 8. Compiler will use undefined behavior to optimize.
by IsTom 13y ago
When compiled with -O3 using g++ it returns 0 8. Compiler will use undefined behavior to optimize.
- mikeash 13y agoThere's a fun example with clang where you can have two pointers where: x == y But: *x != *y It involves invoking undefined behavior by using a pointer after it's been freed and arranging for a new pointer at the exact same location. Clang cached the contents of the old pointer and uses it in the comparison.