9front - general discussion about 9front
 help / color / mirror / Atom feed
* putc/fputc incorrect return?
@ 2020-07-09  8:21 tlaronde
  2020-07-09 14:27 ` [9front] " ori
  0 siblings, 1 reply; 10+ messages in thread
From: tlaronde @ 2020-07-09  8:21 UTC (permalink / raw)
  To: 9front

Hello,

I have been investigating a failure to compile METAFONT fonts on present
version of 9front and found the culprit.

When writing a binary file, putc is used and the macro invoking it was
testing the return not against EOF but against the byte supposed to be
written.

The problem is that, apparently now, putc is returning a signed char
promoted to a signed int, meaning that when the byte written has the
higher bit set, all the higher bits are set in the int returned:

I write, say 0xaa, it returns 0xffffffaa. So when comparing, this
failed.

But the problem is that if I write 0xff it returns 0xffffffff that is
EOF...

Isn't putc/fputc supposed to return a "char" as a value that is
0x000000nn so precisely one can differenciate from EOF error?

Best regards,
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-07-13 12:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09  8:21 putc/fputc incorrect return? tlaronde
2020-07-09 14:27 ` [9front] " ori
2020-07-09 16:17   ` tlaronde
2020-07-09 16:55     ` ori
2020-07-09 18:29       ` tlaronde
2020-07-09 18:39         ` ori
2020-07-11 14:39           ` [FOUND] [9front] putc/fputc incorrect return tlaronde
2020-07-11 15:45             ` ori
2020-07-11 16:43               ` tlaronde
2020-07-13 10:36               ` tlaronde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).