Date: Sun, 21 Jul 1996 23:20:39 +0200 (MET DST) From: J Wunsch <j@uriah.heep.sax.de> To: wosch@cs.tu-berlin.de Cc: joerg_wunsch@uriah.heep.sax.de, freebsd-bugs@FreeBSD.ORG Subject: Re: bin/1386 Message-ID: <199607212120.XAA00862@uriah.heep.sax.de> In-Reply-To: <199607211910.VAA01286@campa.panke.de> from Wolfram Schneider at "Jul 21, 96 09:10:38 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607212120.XAA00862>