Sender: vheyndri AT rug DOT ac DOT be Message-Id: <3497B2AC.5E0A@rug.ac.be> Date: Wed, 17 Dec 1997 12:08:28 +0100 From: Vik Heyndrickx Mime-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: char != unsigned char... sometimes, sigh Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Hi workers, Suppose you have a C program section: int a ='\x84'; int b; b = getc (f); // f is a text file with the next character to read 0x84 if (a == b) return true; return false; I suppose, I don't have to mention that false is returned. I now, assigned a value of '\x84' is not the smartest thing to do, but I think this should be rather considered a bug than a feature. 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. If no objections, I'll make the patches. BTW there may be other functions with similar problems, I'll change those too. I'll be careful about those changes. Regards. -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/