C++ Logo

sg12

Advanced search

Re: [ub] Sized integer types and char bits

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Fri, 25 Oct 2013 13:44:41 -0500
A branch of this discussion, this started on th UB list, accidently went
off to being -ext only discussion after Mathias's reply. Forwarding
my reply here.


attached message:

Matt Austern <austern_at_[hidden]> writes:

| On Fri, Oct 25, 2013 at 10:31 AM, Jeffrey Yasskin <jyasskin_at_[hidden]> wrote:
|
|
|
| Richard explicitly asked whether any such C++ users exist or are
| likely to exist in the future, and nobody's come up with any examples.
| So we appear to have a choice between helping some theoretical people
| or helping some actual people. (We help the actual people by telling
| them what to expect in the standard, while now they have to test and
| hope they find the right subset of undefined or implementation-defined
| behavior that's actually guaranteed to work.)
|
|
| It's actually a little worse than that. Testing can reveal what your
| implementation does today, with your particular input, with one set
| of compiler flags. No amount of testing can reveal what guarantees
| your implementation makes.

There are two separate issues here:

  (1) whether we want C++ to continue to support non-two's complement
      binary representation
  (2) what we want to say about overflowing shift arithmetic

Requiring two's complement does not necessarily solve (2). And solving
(2) does not necessarily imply "no" to (1).

-- Gaby

Received on 2013-10-25 20:44:57