Boost logo

Boost :

Subject: Re: [boost] [Locale] Preview of 3rd version
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-09-11 16:10:46


>
> The code in question is in loop that keeps on going until from reaches
>from_end or the
> conversion fails (due to insufficient input or otherwise), so both surrogates
>should be
> written in the same do_in invocation.

Take a look on my code, I don't update from_next till I write both surrogates,
just sometimes I write them separately as usually uto + 1 == uto_end in
MSVC implementation.

So technically your code is wrong as you write into position of uto_end

>
>
> > Actually the mbstate_t is POD type that should be initialized to 0. I must
>make
> > sure that
> > sizeof(mbstate_t)>= 2, and then I use it as temporary storage for state.
>
> I'm not talking about that, I meant the reinterpret casting between uchar and
>uint_type, but actually I suppose they're the same, maybe just different
>signedness, so that should be somewhat ok.
> It's still not allowed by the strict aliasing rules though.

I use uint16_t cast when sizeof(wchar_t) == 2 and uint32_t cast when sizeof of
wchar_t == 4, I don't
see any problem with this.

So I always cast to pointer of virtually same binary type.

Artyom

      


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