Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: TO C OR NOT TO *C Message-ID: <11336@smoke.BRL.MIL> Date: 19 Oct 89 09:53:01 GMT References: <1989Oct16.172249.18387@utzoo.uucp> <8864@goofy.megatest.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 13 In article <8864@goofy.megatest.UUCP> djones@megatest.UUCP (Dave Jones) writes: >The reason this works is that on the Sun, chars are signed, printable >characters have positive values, and EOF is negative. But you still >should use int, if only to be morally correct. It's not a matter of "morality", it's a matter of practicality. Relying on an implementation quirk will get you into trouble when: - the implementation changes - the compiler is invoked with a switch that treats "char" as unsigned - the code is ported to a different implementation It's especially foolish when it is just as easy to write the code correctly as to write it in an implementation-dependent way.