C++ Logo

sg12

Advanced search

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

From: Lawrence Crowl <Lawrence_at_[hidden]>
Date: Sun, 3 Nov 2013 15:41:18 -0800
On 11/1/13, Daniel Krügler <daniel.kruegler_at_[hidden]> wrote:
> 2013/11/1 Lawrence Crowl <Lawrence_at_[hidden]>:
>> Reading the C standard, there does not seem to be any requirement
>> that uint* typedefs have the same size as the corresponding int*
>> typedefs.
>
> I disagree. According to C99 7.18.1 p1:
>
> "When typedef names differing only in the absence or presence of
> the initial u are defined, they shall denote corresponding signed
> and unsigned types as described in 6.2.5; an implementation
> providing one of these corresponding types shall also provide the
> other."

I missed that. The nice thing about standards clauses is that there
are so many to choose from. :-)

-- 
Lawrence Crowl

Received on 2013-11-04 00:41:21