C++ Logo

sg12

Advanced search

Re: [ub] [c++std-ext-14555] Sized integer types and char bits

From: Xavier Leroy <Xavier.Leroy_at_[hidden]>
Date: Sun, 20 Oct 2013 12:05:23 +0200
Gabriel Dos Reis writes:

> From my view, this underscores the importance for us to keep thinking
> about the issues within a(n abstract) parameterized model, as opposed to
> just the immediate hardware we are familiar with. What do we gain by
> instantiating the entire abstract machine with CHAR_BITS == 8? I can't
> tell. Would we alienate computational devices? Yes. Do we care?
> I think we should. This is just one instance; but I have a sense that
> we actually have a pattern here.

I agree with you concerning CHAR_BITS. But I can't help thinking that
other aspects of integer types could be fully defined without
excluding any known computational device, with the benefit of
simplifying the standards and providing programmers with firmer
grounds to build software on. For example:

- Two's complement representation for signed integer types.
  (Have you seen any one's-complement or sign-magnitude architecture
  these last 40 years? I didn't think so.)

- The existence of intptr_t and uintptr_t types.
  (Just the existence; no guarantees that pointers have unique
  bit-pattern representations.)

What do you think?

- Xavier Leroy

Received on 2013-10-20 12:05:43