$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [Locale] Preview of 3rd version
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-09-12 10:47:47
On 12/09/2010 14:13, Artyom wrote:
>
>>
>> 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.
>>
>
> 1st it don't warns,
I forgot to mention it also requires strict aliasing to be enabled, 
which is the case with -O3.
I do get the warning with the following code:
int main()
{
     wchar_t data[] = L"foo";
     unsigned int* foo = (unsigned int*)data;
     *foo = 0;
}
(on Linux x86, where unsigned int and wchar_t are the same size and 
alignment)