Re: codecvt problem
Seungbeom Kim wrote:
On 2011-06-17 05:42, Ulrich Eckhardt wrote:
This means that all "clean" initialisations
mentioned in this thread (e.g. "mbstate_t s = {};" or "mbstate_t s =
mbstate_t();") are actually not guaranteed to work.
I cannot understand why not. Can you explain it further?
1. a null pointer doesn't have to have all its bits zero
2. memset(&ptr, 0, sizeof ptr) only guarantees that all bits are zero, but
not that 'ptr' becomes a null pointer
3. above mentioned "clean" initialisations of pointers yield null pointers
With that, assuming the spec requires an initialisation with memset(),
other
initialisations where a pointer might become a null pointer are actually
not
portable, because they give a different result.
That said, I agree that this is a point where the standards could be
improved, especially in the light of what you quoted from the C standard,
where it allows a "zero-valued" object as initial state.
Uli
--
Domino Laser GmbH
Gesch??ftsf??hrer: Thorsten F??cking, Amtsgericht Hamburg HR B62 932
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]