4 ms·
The C++ committee recently (for the C++20 standard) voted against making signed overflow defined, opting to keep it undefined. Primarily for performance reasons
by MauranKilom 5y ago
The C++ committee recently (for the C++20 standard) voted against making signed overflow defined, opting to keep it undefined. Primarily for performance reasons (and because it would usually be a bug anyway).
www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0907r4.html#r0r1
You're of course free to disagree with the reasoning. But you'd probably agree that a new standard revision that forces the average application to become, say, 5% slower, just so that broken programs would be just as broken, would not be very well-received.
- olliej 5y agoI’m not willing to accept a “say” for performance here. I’d also want performance impact on a non-benchmark perf sensitive code base (browser, database, etc rather than spec). The problem with the claim that the code is incorrect is that it is only* incorrect due to the imo bogus interpretation of what should be UB. If I write If (a+b<a) On any modern architecture that has a well defined and understood meaning. But compilers have repeatedly overridden I well understood behavior in the name of perf benefits that only turn up in Spec-style benchmarks