Subject: Re: [ub] An update on signed integers
From: JF Bastien (cxx_at_[hidden])
Date: 2018-03-16 13:06:31
On Fri, Mar 16, 2018 at 2:04 PM, Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
> P0907r1 proposes this addition relative to the WD:
> > If overflow caused by an operation which would require representing an
> integer which cannot be represented by the type, the behavior is undefined.
> However, it simultaneously proposes these deletions relative to the WD:
> > [*Note:* Operators can be regrouped according to the usual mathematical
> rules only where the operators really are associative or commutative ...
> > an operation that would have undefined behavior as specified in Clause
> 4 through 19 of this document [*Note*: including, for example, signed
> integer overflow, certain pointer arithmetic, division by zero, or
> certain shift operations â*end note*]
> The removals are all non-normative, but they seem to be aimed at
> eliminating references to "signed overflow is UB", even though signed
> overflow *is* still UB. Was there a sense in the room that we wanted to
> downplay the importance of *teaching* signed UB in C++, but not actually
> eliminate the UB itself? Or what's the point of re-wording these existing
There was extensive discussion of this note, what to add / remove, etc, and
no direction as to where to go. I'll ask EWG today.
> Also, separately and less importantly, I'd love to hear someone's
> rationale for making (1<<31) UB in C++2a when it's IDB in C++17. The straw
> poll result in P0907r1 sounds unambiguous, but I don't understand what
> rationale could exist for taking this construct from IDB into UB. Is the
> assumption that people haven't yet had a chance to write any programs whose
> correctness depends on the value of (1<<31), so if we change it back to UB
> fast enough, nobody will notice?
The notes should help clarify RIchard's rationale for proposing this.
> On Fri, Mar 16, 2018 at 8:56 AM, JF Bastien <cxx_at_[hidden]> wrote:
>> Hello EWG,
>> SG6 and SG12 discussed wg21.link/P0907r0 Signed Integers are Twoâs
>> Complement and provided extensive feedback.
>> I've attached an updated paper listing polls and addressing most feedback
>> (except some wording fiddle) to the EWG wiki for this afternoon's
>> ub mailing list
SG12 list run by email@example.com