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

Eugene D. Brooks III brooks at lll-crg.ARPA
Mon Apr 29 10:51:18 AEST 1985


> 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

I will agree with a claim that (10 == j) is not very pleasing to the eye
when you first see it.  To claim that it is a perversion of C is going a
little too far.  It legal C and usage has a definite purpose for the error
prone.  To then claim that while(1) is wrong and that the proper way to do
the same thing is for(;;) is going even further.  Beauty is in the eye of
the beholder.  I understand what is being done with while(1), the compiler
understands what is being done with while(1), even YOU understand what is
being done with while(1).  Hence its good C and does not deserve to be called
wrong.  For(;;) is not quite as clear to me and I would have to check the
manual first.

So lets cool the flame on a good suggestions that have the origin in the
solution for a problem that bites many.



More information about the Comp.lang.c mailing list