Funny mistake

Bill Campbell bill at camco.Celestial.COM
Sun Mar 17 07:54:32 AEST 1991


In <15481 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:

>In article <8148 at rsiatl.Dixie.Com> stan at Dixie.Com (Stan Brown) writes:
>>>"if (a = b)" instead of "if (a == b)". 
>>... I have yet to see a UNIX compiler complain about it

>That's good, because it is valid C and the compiler cannot know whether
>or not it reflects the programmer's intentions.

My personal preferance would be a WARNING message.  Certainly it
is a legal construction, but 90% of the time when I do this it
was my mistake!  I'm not perfect and I would like the compiler to
point out places where it is likely that I didn't do something
right.

I usually avoid this particular construction simply because every
time I look at it at some later date I will have to figure out
whether I did it right in the first place :-)

Bill
-- 
INTERNET:  bill at Celestial.COM   Bill Campbell; Celestial Software
UUCP:   ...!thebes!camco!bill   6641 East Mercer Way
             uunet!camco!bill   Mercer Island, WA 98040; (206) 947-5591



More information about the Comp.lang.c mailing list