how has C bitten you? (Really, style)
Alan Fargusson
alan at drivax.UUCP
Fri Aug 23 02:15:05 AEST 1985
> 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>
I have to tell you that I got bit the same way in PASCAL when I was
a student. This is not just a C problem. I think that all of the
strucutred languages I have seen (except Modula-2, and Algol 68)
have this problem.
--
Alan Fargusson.
{ ihnp4, amdahl, mot }!drivax!alan
More information about the Comp.lang.c
mailing list