delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/12/17/07:38:22

From: molnarl AT cdata DOT tvnet DOT hu
Date: Wed, 17 Dec 1997 13:37:02 +0100 (MET)
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: djgpp-workers AT delorie DOT com
Subject: Re: char != unsigned char... sometimes, sigh
In-Reply-To: <3497B2AC.5E0A@rug.ac.be>
Message-ID: <Pine.SOL.3.95.971217133116.1311B-100000@dumballah.tvnet.hu>
MIME-Version: 1.0

On Wed, 17 Dec 1997, Vik Heyndrickx wrote:

> int a ='\x84';
> int b;

What's wrong with "int a=0x84;" ? :-)

> b = getc (f); // f is a text file with the next character to read 0x84
[]
> The reason is that getc returns a value in the range [0..255] or -1, and
> chars are signed on this platform.
> Since getc is only supposed to be used for text files, I think we should
> change it to return chars in the range [-128..127], so that comparisons
> work.

I think this is a bad idea, because most programs assume that EOF is -1.

Laszlo


- Raw text -


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