Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!shannon From: shannon@sun.uucp (Bill Shannon) Newsgroups: net.lang.c Subject: Re: condition convention 'if (10 == j)...' Message-ID: <2140@sun.uucp> Date: Sat, 27-Apr-85 01:58:39 EDT Article-I.D.: sun.2140 Posted: Sat Apr 27 01:58:39 1985 Date-Received: Mon, 29-Apr-85 00:06:43 EDT References: <137@bocklin.UUCP> <1456@amdahl.UUCP> Organization: Sun Microsystems, Inc. Lines: 23 > > To prevent silly mistakes like > > if (j = 10) > > I usually write > > if (10 == j) > > By putting the constant first, I ensure that the compiler will catch the > > typo. > > I think this is a good idea. Any criticisms? The only problem > I have with it is that I am not accustomed to reading code written > this way. > -- > Gordon A. Moffett ...!{ihnp4,cbosgd,sun}!amdahl!gam What do you mean, any criticisms? This is one of the most ugly perversions of C I've ever seen! I tend to read this in terms of "if variable equals constant" and try to figure out how the value "10" is ever going to change! YUCK YUCK YUCK!!!! People that write "if (10 == j)" probably also write "while (1)". What do you mean, "while 1"??? Are you expecting "1" to change??? Everyone knows this should be written "for (;;)", read "forever". Bill Shannon