Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ttrdc.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!mgnetp!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: net.lang.c Subject: Re: how has C bitten you? (Really, style) Message-ID: <372@ttrdc.UUCP> Date: Mon, 19-Aug-85 12:41:52 EDT Article-I.D.: ttrdc.372 Posted: Mon Aug 19 12:41:52 1985 Date-Received: Fri, 23-Aug-85 21:16:30 EDT References: <302@brl-tgr.ARPA> <4081@alice.UUCP> <243@ecrhub.UUCP> <123@ecsvax.UUCP> <389@phri.UUCP> Distribution: net Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 30 In article <389@phri.UUCP>, roy@phri.UUCP (Roy Smith) writes: > Here's one that just got me: > > if (sv > score); <----- note extraneous semi-colon > score = sv; > > This was in a series of computations which gave various scores; the >fragment above was repeated in various places to pick out the maximum. Of >course, the test is a no-op and the assignment was always done. Naturally, >this passes lint (even with the -h flag which uses "heuristic tests to >attempt to intuit bugs") without any complaint. >-- >Roy SmithSounds like a question of style hiding function. Why not stick to something like if (sv > score) score = sv; ? I can't think of anything much more straightforward than that. -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer, my pets, my plants, my boss, or the | at&t computer systems division | s.a. of any computer upon which I may hack. | skokie, illinois | | "go for it" | Path: ..!ihnp4!ttrdc!levy -------------------------------- or: ..!ihnp4!iheds!ttbcad!levy