Mail Archives: djgpp-workers/2000/06/15/15:23:18
> Date: Thu, 15 Jun 2000 16:30:06 +0200
> From: Laurynas Biveinis <lauras AT softhome DOT net>
>
> Eli Zaretskii wrote:
>
> > On Thu, 15 Jun 2000, Holejsovsky, Pavel wrote:
>
> > > #ifndef WEOF
> > > #define WEOF (wint_t)(0xFFFF)
> > > #endif
> >
> > Ouch, I hate to mix signed and unsigned! Unless I'm haunted by the
> > shadow of a dwarf here, someone will have to make sure this doesn't break
> > our trivial implementation of wide characters (since WEOF starts as EOF).
>
> Where exactly in the sources is that trivial implementation?
> I can't find any place (except for headers) where WEOF is referenced.
Don't look for WEOF, it indeed is not mentioned. Instead, look at
functions such as mbtowc, mblen, wctomb, etc. You will see that all
they do is to take a char and put it into a wchar_t, or the other way
around.
In other words, out ``multibyte characters'' always have 1-byte
length, and our ``wide characters'' are simply sign-extended ASCII
characters.
Now, imagine that a character is read from a file (via `getc', say),
and then is passed through `mbtowc'. What bothers me is this: what
happens if `getc' returned EOF? I don't have the standard handy, but
isn't EOF supposed to be converted to WEOF? If it is, we may have
problem with mixing signed and unsigned.
- Raw text -