Boost logo

Boost :

Subject: Re: [boost] [Locale] Preview of 3rd version
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-09-12 08:19:58


On 12/09/2010 11:32, Artyom wrote:
>> Unfortunately, wchar_t is a different type from uint16_t or uint32_t,
>> so what you are doing probably counts as breaking the strict aliasing rule.
>
> C++0x char16_t and char32_t are define as
>
>> Types _Char16_t and _Char32_t denote distinct types with the same size,
>> signedness,

That's not how it is in C++0x.
char16_t and char32_t are directly keywords, which has the bad effect or
preventing you from defining types with such names.

>>
>> and alignment as uint_least16_t and uint_least32_t,
>> respectively, in<stdint.h>, called the underlying types.
>
> So no problems there,

Yes there are.
It has nothing to do with size and alignment. It's different types, so
the compiler is allowed to assume the memory doesn't alias so that it
can do smart optimizations.

If you compile your code with -Wstrict-aliasing with GCC, you will get a
warning that says so.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk