how has C bitten you? (Really, style)

Daniel R. Levy levy at ttrdc.UUCP
Tue Aug 20 02:41:52 AEST 1985


In article <389 at phri.UUCP>, roy at 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 Smith <allegra!phri!roy>

Sounds 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



More information about the Comp.lang.c mailing list