Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.16 $; site ISM780.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!bbnccv!ISM780!darryl From: darryl@ISM780.UUCP Newsgroups: net.lang.c Subject: Re: Re: No Such Thing (errata) Message-ID: <30000010@ISM780.UUCP> Date: Fri, 30-Aug-85 08:38:00 EDT Article-I.D.: ISM780.30000010 Posted: Fri Aug 30 08:38:00 1985 Date-Received: Sun, 1-Sep-85 05:50:41 EDT References: <1007@brl-tgr.UUCP> Lines: 42 Nf-ID: #R:brl-tgr:-100700:ISM780:30000010:000:1772 Nf-From: ISM780!darryl Aug 30 08:38:00 1985 >To me, the mapping TRUE -> 0 and FALSE -> non-zero doesn't seem obvious, That's probably because you have it turned around... TRUE -> nonzero, FALSE -> 0. >In assembler, one often writes the following (I'm using pseudocode >rather than any particular assembler): > > compare two values > jumpto stuff if zero > >Which is the assembler equivalent of > > if (value1 == value2) > ; Once again, you seemed slightly confused... These two don't exactly match each other. In assembler, you probably jump around the code. If you do, then you want to jump on nonzero, assuming the C code is what you really wanted. In any event, C's approach is very assembler-like; any conditional has an implicit comparison against zero, just like most machines support. >When I was in high school I was programming TRS-80's in both assembler >and BASIC, and I had lots of trouble remembering whether BASIC >represented truth as zero or -1. No such memory is needed for the >assembler, of course, since comparison is merely done by subtraction (a >compare instruction is usually just a subtract instruction that doesn't >store the result anywhere), so it is obvious what the zero indicator >means. It is not so obvious to me that in C 0 should mean false and 1 >mean true. If you don't feel comfortable with a language, use another or spend the time and effort to become comfortable. C is certainly not my choice for a beauty contest, but one can craft large, useful programs that can then be run, reasonably efficiently, on many machines. I suppose that there is some beauty to that, after all. --Darryl Richman, INTERACTIVE Systems Corp. ...!cca!ima!ism780!darryl The views expressed above are my opinions only.