[ub] Aliasing char16_t with int_least16_t, etc.

Jean-Marc Bourguet jm at bourguet.org
Thu Oct 31 09:25:43 CET 2013


On 31/10/2013 01:28, Lawrence Crowl wrote:
> On 10/30/13, Jean-Marc Bourguet <jm at bourguet.org> 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


More information about the ub mailing list