delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/15/15:23:18

Message-Id: <200006151855.VAA06521@mailgw1.netvision.net.il>
Date: Thu, 15 Jun 2000 21:57:21 +0200
X-Mailer: Emacs 20.6 (via feedmail 8.1.emacs20_6 I) and Blat ver 1.8.5b
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
To: Laurynas Biveinis <lauras AT softhome DOT net>
CC: djgpp-workers AT delorie DOT com
In-reply-to: <3948E86E.E28D1AE8@softhome.net> (message from Laurynas Biveinis
on Thu, 15 Jun 2000 16:30:06 +0200)
Subject: Re: Patch: sentinels for typedefs in headers
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000615113540 DOT 11632V-100000 AT is> <3948E86E DOT E28D1AE8 AT softhome DOT net>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019