This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: patch: remaining -Wall warnings
Ulrich Drepper <drepper@cygnus.com> writes:
> Benjamin Kosnik <bkoz@cygnus.com> writes:
>
> > I can either break the standard, and have char_traits::eof() not return
> > int_type but long or unsigned long,
> >
> > or
> >
> > change char_traits::int_type to long or unsigned long
>
> I don't see the problem. In the initial mail there was a comparison
> with a negative number. This never must happen. So I assume you must
> mean something else. Defining int_type to wint_t for wide chars
> should be correct.
The char_traits<wchar_t>::eof() value is int_type(-1), which ends up
being the same (in my case, at least) as if `return 0xffffffff' had
been written.
So, I still think the patch I submitted is correct. But I must
admit I'm not sure I understand what the significance of the -2's in
that code is--in, say, istreambuf_iterator (sbuf_iter.h). What did
the author really mean when he wrote `_M_c>-2'? My patch changed
that test to `_M_c!=int_type(-2)' on the assumption that _M_c was
never intended to have a value <-2.
I think -2 means "before the beginning of the file" (i.e., we
haven't yet read anything from this stream). That would seem to
require that wint_t(-2) is an invalid UCS4 character. Is that
right?
M.