C++ Logo

SG12

Advanced search

Subject: Re: [ub] Sized integer types and char bits
From: Lawrence Crowl (Lawrence_at_[hidden])
Date: 2013-10-24 18:10:29


On 10/24/13, Gabriel Dos Reis <gdr_at_[hidden]> wrote:
> Lawrence Crowl
> > While it is a bit daunting of a task, changing the definition of
> > builtin-operators to state their preconditions explicitly would
> > help to lessen the surprise at removing the explicit condition.
>
> Would you volunteer to take a first stab at it?

I do not think I should add this task to my plate.

> > > I suppose a subsidiary question is whether INT_MAX is considered
> > > 'correct data' for the operation "++i".
> >
> > I say i == INT_MAX violates the operation's precondition.
>
> Our current Standardese vocabulary for Core does not include this.

Not explicitly, but by implication. Avoiding the undefined behavior
of overflow implies the precondition.

> Are you saying that it is correct data (of type int) but violates
> the domain of definition of prefix increment?

Yes.

> Or are you suggesting that we should introduce a new category?

No.

> Or are you suggesting we should all go home because everything
> is fine (undefined behavior)? :-)

No. We clearly have a need to clarify what we mean and clarify
to the community how we feel the language should be used.

> It would be good if we can seize the opportunity to do
> something in this area.

Agreed.

-- 
Lawrence Crowl

SG12 list run by herb.sutter at gmail.com