From owner-freebsd-bugs Sun Jul 21 15:28:39 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA00943 for bugs-outgoing; Sun, 21 Jul 1996 15:28:39 -0700 (PDT) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id PAA00938 for ; Sun, 21 Jul 1996 15:28:36 -0700 (PDT) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id AAA04612; Mon, 22 Jul 1996 00:28:24 +0200 Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id AAA16338; Mon, 22 Jul 1996 00:28:24 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.7.5/8.6.9) id XAA00862; Sun, 21 Jul 1996 23:20:40 +0200 (MET DST) From: J Wunsch Message-Id: <199607212120.XAA00862@uriah.heep.sax.de> Subject: Re: bin/1386 To: wosch@cs.tu-berlin.de Date: Sun, 21 Jul 1996 23:20:39 +0200 (MET DST) Cc: joerg_wunsch@uriah.heep.sax.de, freebsd-bugs@FreeBSD.ORG Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199607211910.VAA01286@campa.panke.de> from Wolfram Schneider at "Jul 21, 96 09:10:38 pm" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Wolfram Schneider wrote: > >Because this still remains the C programmer's error #1. > > > >Think about it. getc() returns an int. > > We have dozens char c = getc() in our source tree. It seems lpf is the > only program which had real problems with this error. Use an architecture where chars are unsigned by default (or make gcc behave this way), and you'll notice the offenders very quickly. :-] For default signed chars, the programs only break by misdetecting the (valid but barely used) character '\xff' as EOF. The other way round, they will misinterpret EOF as '\xff', and never go to an end... lpf only broke for characters other than '\xff' since the code compares for `less than' (while most programs certainly don't do this). This is bogus (the program should use the ctype functions anyway), but made the error obvious. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)