3 ms·
This is a list of optimization patterns; it's not an analysis of how much actual code gets sped up, and it doesn't consider the accommodations that would be mad
by barrkel 11y ago
This is a list of optimization patterns; it's not an analysis of how much actual code gets sped up, and it doesn't consider the accommodations that would be made in the alternative universe: where defined signed overflow is the default, and there are other tools for when this impacts performance too much.
The question is if the alternative universe is better than this one, where you have to work harder to protect against unwanted overflow - and especially the compiler eliminating your efforts to test whether it occurred or not.
- Gibbon1 11y agoI'm of the opinion that they should add a way to force two's complement behavior for signed integers. And add that to he definition of int32_t, etc. At that point everyone is happy. People interested in safe solid code can use int32_t, etc. And the people interested in writing the best optimizations and the fastest code can masturbate away.
- joosters 11y agoThe command line switch '-fno-strict-overflow' will grant you access to this alternative universe.
- barrkel 11y agoThe alternative universe includes a different C++ standard and potentially additional language constructs or types to opt out. Different defaults have cultural implications far beyond the mechanics of any single compile.