Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site brl-vgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!harpo!seismo!brl-tgr!brl-vgr!gwyn From: gwyn@brl-vgr.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: C programming syle poll Message-ID: <1203@brl-vgr.ARPA> Date: Tue, 1-May-84 18:01:55 EDT Article-I.D.: brl-vgr.1203 Posted: Tue May 1 18:01:55 1984 Date-Received: Wed, 2-May-84 06:33:36 EDT References: <137@iwlc6.UUCP> Organization: Ballistics Research Lab Lines: 30 x == 5 evaluates to 1 (nothing else!) if true, 0 if false. However, I agree that y = x == 5; is poor programming practice IF Y IS AN INT. It is perfectly okay if you make the distinction between ints and Booleans, and is common practice in well-written Pascal and even Fortran. E.g. typedef int bool; foo() { register bool y; int x; ... y = x == 5; ... if ( y ) ... } I recommend AGAINST performing arithmetic with Booleans (i.e., using a Boolean datum as a numerical 1 or 0); this is illegal in other Algol-based languages and comes under the heading of "tricky" coding. I religiously keep ints and Booleans distinct in my code and have found that it helps keep the code clean and understandable.