C++ Logo

sg12

Advanced search

Re: [ub] Sized integer types and char bits

From: Lawrence Crowl <Lawrence_at_[hidden]>
Date: Thu, 24 Oct 2013 16:10:29 -0700
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

Received on 2013-10-25 01:10:31