9front - general discussion about 9front
 help / color / mirror / Atom feed
From: tlaronde@polynum.com
To: 9front@9front.org
Subject: putc/fputc incorrect return?
Date: Thu, 9 Jul 2020 10:21:11 +0200	[thread overview]
Message-ID: <20200709082111.GA880@polynum.com> (raw)

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


             reply	other threads:[~2020-07-09  8:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  8:21 tlaronde [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200709082111.GA880@polynum.com \
    --to=tlaronde@polynum.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).