C++ Logo

sg12

Advanced search

Re: [ub] Aliasing char16_t with int_least16_t, etc.

From: Jean-Marc Bourguet <jm_at_[hidden]>
Date: Thu, 31 Oct 2013 09:25:43 +0100
On 31/10/2013 01:28, Lawrence Crowl wrote:
> On 10/30/13, Jean-Marc Bourguet <jm_at_[hidden]> wrote:
>> Does 3.10/10 covers the puning between uint_leastXX_t and
>> int_leastXX_t?
> I believe so, because those are just typedefs and they are
> required to point to the same size.
>
Are you sure? I though it was a requirement on value bits and
thus the typedef could be on the next size.

A machine similar to the unysis described by Ion which has to
ignore the sign type in unsigned instead of making it contribute
to the value could have a 16 bits type whose unsigned correspondent
has a max of 2^15-1. If I'm not mistaken, it would have to be
used as int_least16_t but the unsigned can't be used as uint_least16_t.

(That type has to be an extended integer as USHRT_MAX has to be at
least 65535 and unsigned char can't have padding bits).

Yours,

-- 
Jean-Marc

Received on 2013-10-31 09:26:02