2 ms·
There’s not an underlying principle here, just trying to avoid nasty surprises. Many optimizations are in practice unreliable—they are buried in the depths of
by klodolph 4y ago
There’s not an underlying principle here, just trying to avoid nasty surprises.
Many optimizations are in practice unreliable—they are buried in the depths of a compiler and not part of the docs, it may be difficult to find out what conditions are necessary for the optimization to work, you may find that an optimization stops working when you update your compiler, you may find that changing a seemingly-unrelated piece of code breaks the optimization (maybe some function is no longer inlined for various reasons), or you may use a different compiler.
So I prefer to write code that works correctly without optimizations. It’s not a hard rule, but in this scenario, I would prefer to rewrite the code—and this happens to be annoying here.