Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: Assignment in test: OK? Message-ID: <1990Sep11.003102.9271@virtech.uucp> Date: 11 Sep 90 00:31:02 GMT References: <1990Sep5.185451.25532@DRD.Com> <928@hls0.hls.oz> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 33 In article <928@hls0.hls.oz> george@hls0.hls.oz (George Turczynski) writes: >In article , burley@world.std.com (James C Burley) writes: >> Your code is fine IMHO. But suppose you had written the following >> accidentally: >> >> if (foo = 0) >> >> This is a common mistake. > >(typing mistake ?) > >This is only a mistake if you don't know what you're doing (or you have a >typo, in which case it's only a mistake for a short while). It is, in fact, >perfectly legal C, but isn't what people sometimes want it to mean. This is a BIG mistake because of any and all of the following: 1. you might have made a typo 2. someone else will have to determin if you might have made a typo 3. If it was a typo, these kinds of problems sometimes don't show themselves for years and can be the hardest things to debug because even though there is only a single = there you keep reading the code and seeing two of them. The fact that it is legal C doesn't really matter here. That kind of coding just makes maintenance harder. -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170