Am 27.11.2018 um 21:02 schrieb Emil Dotchevski via Boost:
On Tue, Nov 27, 2018 at 11:14 AM Daniela Engert via Boost < boost@lists.boost.org> wrote:
If only there were a signed integral type with modulo arithmetic in C++. In other words: the raw underlying hardware implementation without the UB semantics demanded by C++.
The result would be:
1) Compilers would generate less optimal code, as demonstrated by this discussion. 2) You will still get a mathematically incorrect result most of the time.
Did you actually bother to think about my proposal? I don't want to take away 'int' (as it is specified in the language). I want an *additional* signed integral type with a sane mathematical definition: an abelian group with modulus. And it should offer a widening multiplication N * N -> 2N in addition to the regular one N * N -> N. The compiler should know about this type and lower it's operations to the corresponding hardware instruction (in most cases a single one). Ciao Dani