From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp26.services.sfr.fr ([93.17.128.194]) by ewsd; Thu Jul 9 04:22:42 EDT 2020 X-mail-filterd: 0.5.0 X-sfr-mailing: LEGIT X-sfr-spamrating: 40 X-sfr-spam: not-spam Received: from cauchy.polynum.local (89.121.198.77.rev.sfr.net [77.198.121.89]) by msfrf2609.sfr.fr (SMTP Server) with ESMTP id ECAA41C000424 for <9front@9front.org>; Thu, 9 Jul 2020 10:22:26 +0200 (CEST) Received: from cauchy.polynum.local (89.121.198.77.rev.sfr.net [77.198.121.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by msfrf2609.sfr.fr (SMTP Server) with ESMTPS for <9front@9front.org>; Thu, 9 Jul 2020 10:22:26 +0200 (CEST) Received: from cauchy.polynum.local (localhost [127.0.0.1]) by cauchy.polynum.local (8.15.2/8.15.2) with ESMTP id 0698LBBM000718 for <9front@9front.org>; Thu, 9 Jul 2020 10:21:11 +0200 (CEST) Received: (from tlaronde@localhost) by cauchy.polynum.local (8.15.2/8.14.9/Submit) id 0698LBBm000875 for 9front@9front.org; Thu, 9 Jul 2020 10:21:11 +0200 (CEST) X-Authentication-Warning: cauchy.polynum.local: tlaronde set sender to thierry.laronde@sfr.fr using -f Date: Thu, 9 Jul 2020 10:21:11 +0200 From: tlaronde@polynum.com To: 9front@9front.org Subject: putc/fputc incorrect return? Message-ID: <20200709082111.GA880@polynum.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: responsive converged grid singleton 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 http://www.kergis.com/ http://www.sbfa.fr/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C