C++ Logo

SG12

Advanced search

Subject: Re: [ub] [c++std-ext-14555] Sized integer types and char bits
From: Lawrence Crowl (Lawrence_at_[hidden])
Date: 2013-10-23 23:35:31


On 10/20/13, Gabriel Dos Reis <gdr_at_[hidden]> wrote:
> You are quite correct that I have not myself written code for
> non-simulated hardware I have personal knowledge of being
> sign-magnitude or 1's complement.
> However:
> a. Existence of such machines and their being continually sold
> have been reported by various people;
> b. It is not clear that the support for one's complement or
> sign-magnitude adds a substantial complication, or that a
> substantial simplification of the standards specification is
> to be gained from introducing that requirement. For example,
> I don't think support for these binary representation would
> stop us from modifying the specification of signed integer
> arithmetic overflow -- my take-away from the Chicago meeting
> was that defining that be wrapping will be a very terrible
> idea would meet opposition.

While I am one of the folks advocating undefined behavior for integer
overflow, I do not think that implies that we do not care about the
representation of sign. In particular, knowing that (a) there is no
trap value and (b) that there is a 1-1 mapping from pit patterns to
integral numbers affects how programmers interpret data.

Having said that, my expectation is that programmers that care about
(a) and (b) also care about the size of the integer. In that case,
int32_t et.al. require a two's complement representation. The
programmers that care should use those typedefs.

Net result, no change to the standard.

-- 
Lawrence Crowl

SG12 list run by herb.sutter at gmail.com