Sender: vheyndri AT rug DOT ac DOT be Message-Id: <34992D9D.6157@rug.ac.be> Date: Thu, 18 Dec 1997 15:05:17 +0100 From: Vik Heyndrickx Mime-Version: 1.0 To: Eli Zaretskii , dj AT delorie DOT com Cc: djgpp-workers AT delorie DOT com Subject: Re: char != unsigned char... sometimes, sigh References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk A combined reply, be warned! DJ Delorie wrote: > Changing getc to return char instead of int makes DJGPP different from > other compilers, which return int even when chars are unsigned. Given > how long compilers have been doing this, I think it would be a mistake > to make this change, no matter how well-intentioned it may be. It is not exactly that I want to make char the return type of getc. > Returning char instead of int also makes it *impossible* to reliably > detect EOF when reading binary files (without using feof()). Programs > expect -1 to mean EOF, and forcing them to use feof() would mean extra > work to port most programs - work which would not be needed if we just > leave getc() alone. If getc is used for reading binary files, yes, this is an huge problem. Eli Zaretskii wrote: > I disagree. `getc' can be (and is) used to read binary files as well; > I've seen enough programs which do that. We cannot IMHO live with `getc' > that doesn't know how to read 0xff. I've never seen this use, but I'll take your word for it. To be honest I'm not so thrilled about this EOF problem either. I just thought for a short moment to change the value of EOF, but this creates again at least two serious problems. It seems this little problem is too difficult to solve by making the return values negative. The original reason I came up with this solution was that I thought that making -funsinged-char the default was probably too much to ask. But after hearing these arguments, it seems the better solution. Would this be an option? -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/