condition convention 'if (10 == j)...'

G A Moffett gam at amdahl.UUCP
Sat Apr 27 14:16:42 AEST 1985


> 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



More information about the Comp.lang.c mailing list