Boost logo

Boost :

Subject: Re: [boost] Current Guidance on Compiler Warnings?
From: Robert Ramey (ramey_at_[hidden])
Date: 2018-11-28 18:19:50

On 11/28/18 8:34 AM, Daniela Engert via Boost wrote:
> 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_at_[hidden]> 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).

Would this be of value only in the (special) case where N is a power of
2? Seems like a very special case to me. For such a special case, I'd
expect to be able to insert some inline assembler to do the job as
opposed to altering the core language.

> Ciao
> Dani
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at