Boost logo

Boost :

Subject: Re: [boost] [Safe Numerics] Bitwise ops
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-12 14:37:26


John Maddock wrote:

> So I believe the correct behaviour should be:
>
> * Bitwise operations on signed types should be allowed by default as long
> as they don't invoke undefined behaviour by operating on (or generating)
> negative values - this should be a runtime check.

Agreed.

The amusing consequence (I'm easily amused) is that one will be able to
check that a safe<int> x is nonnegative with x | 0, a well known Javascript
idiom.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk