Mail Archives: djgpp-workers/1997/12/17/06:08:58
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 /
\ /-_-_-_-_-_-_/
- Raw text -