Large file iostreams
Martin Sebor
sebor@roguewave.com
Wed Sep 3 16:28:00 GMT 2003
Nathan Myers wrote:
> On Mon, Sep 01, 2003 at 09:42:40AM -0000, P?tur Run?lfsson wrote:
>
>>Martin Sebor wrote:
>>
>>>>27.4.3.1 p2: The initial value of state() is not specified.
>>>
>>>That's not necessarily a defect, is it?
>>
>>Probably not, it's just annoying.
>
>
> No, it's a defect. At least at one time there was text in the
> standard that required that stateT (and by extension mbstate_t)
> could be initialized with stateT(), and that matched the state
> at the beginning of a sequence. I don't find that text now,
> and it's essential. Without it, all the multibyte stuff is
> meaningless.
What I meant was that if the state of an fpos object that's not
explicitly initialized is not specified, it doesn't make objects
of the type impossible to use correctly with multibyte-encoded
streams. I.e., portable code must explicitly initialize the
state before using the fpos object:
fpos<mbstate_t> p (0); // state may be uninitialized
p.state (mbstate_t ()); // initialize it here
That said, I can't think of any advantages of a fpos default
ctor with these tricky semantics, so tightening up the spec
to require that the default ctor default-initialize the state
member would be fine by me.
Martin
More information about the Libstdc++
mailing list