Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mips.UUCP Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!packard!hoxna!houxm!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!Glacier!mips!jmoore From: jmoore@mips.UUCP (Jim Moore) Newsgroups: net.lang.c Subject: Re: how has C bitten you? Message-ID: <166@mips.UUCP> Date: Tue, 13-Aug-85 12:21:09 EDT Article-I.D.: mips.166 Posted: Tue Aug 13 12:21:09 1985 Date-Received: Sat, 17-Aug-85 15:23:49 EDT References: <302@brl-tgr.ARPA> <4081@alice.UUCP> <243@ecrhub.UUCP> <123@ecsvax.UUCP> <389@phri.UUCP> Distribution: net Organization: MIPS Computer Systems, Mountain View, CA Lines: 28 > > Here's one that just got me: > > if (sv > score); <----- note extraneous semi-colon > score = sv; > .... > -- > Roy Smith> System Administrator, Public Health Research Institute > 455 First Avenue, New York, NY 10016 I have seen this bug many times, especially in code written by people who routinely switch programming languages. It does seem that the compiler should warn that that test is a no-operation. The problem in general is that there are 2 copies of the same information: the control flow of the program. The compilers copy is contained strictly in the syntax of the program, while the programmers copy is more loosely defined by program layout conventions. It is strictly up to the programmer to keep the 2 copies in sync in some situations. There was a paper given at a USENIX (Toronto?) describing an experiment with different program layout techniques. The programs were written without any explicit grouping brackets, and were specified by the layout and indentation. A program filter would add all the required brackets and buzzard wings before feeding it to the compiler. Jim Moore MIPS Computer Systems Mountain View, Ca [ucbvax | decvax]!decwrl!mips!jmoore