Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site tesla.UUCP Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!cord!hudson!bentley!hoxna!houxm!vax135!cornell!tesla!mac From: mac@tesla.UUCP (Michael Mc Namara) Newsgroups: net.lang.c Subject: Re: condition convention 'if (10 == j)...' Message-ID: <558@tesla.UUCP> Date: Wed, 1-May-85 04:00:04 EDT Article-I.D.: tesla.558 Posted: Wed May 1 04:00:04 1985 Date-Received: Fri, 10-May-85 23:40:02 EDT References: <137@bocklin.UUCP> <1456@amdahl.UUCP> <2140@sun.uucp> Reply-To: mac@tesla.UUCP (Michael Mc Namara) Organization: Cornell University, Electrical Engineering Dept. Lines: 45 In article <2140@sun.uucp> shannon@sun.uucp (Bill Shannon) writes: >> > 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 While we're setting nets for ourselves, why not # define .EQ. == Then we can say if ( j .EQ. 10 ) fortran--; I believe all this belongs in the crutch box of (weak *) programmers; Sure, you CAN do it if you WANT to, but I'll just %s/.EQ./==/g^M/# define == ==^Mdd^M all your files ;-)))))))) ^ | necessary due to first command (-: ^ | so whats the matter with lefties? ---------------------------------------------------------------------------- I want to go where the climate suits my clothes | mac@tesla | What article? ----------------------------------------------------------------------------