Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 alpha 4/15/85; site sdchema.sdchema.UUCP
Path: utzoo!linus!philabs!prls!amdimage!amdcad!decwrl!decvax!tektronix!hplabs!sdcrdcf!sdcsvax!sdcc3!sdchema!tps
From: tps@sdchema.UUCP (Tom Stockfisch)
Newsgroups: net.lang.c
Subject: Re: how has C bitten you?
Message-ID: <432@sdchema.sdchema.UUCP>
Date: Wed, 14-Aug-85 16:00:12 EDT
Article-I.D.: sdchema.432
Posted: Wed Aug 14 16:00:12 1985
Date-Received: Tue, 20-Aug-85 01:47:50 EDT
References: <302@brl-tgr.ARPA> <4081@alice.UUCP> <243@ecrhub.UUCP> <123@ecsvax.UUCP> <389@phri.UUCP>
Reply-To: tps@sdchema.UUCP (Tom Stockfisch)
Distribution: net
Organization: Chemistry Dept, UC San Diego
Lines: 25

<>
roy@phri.UUCP (Roy Smith) writes:

>	Here's one that just got me:
>
>		if (sv > score);   <----- note extraneous semi-colon
>			score = sv;

This type of error is easy to find with cb(1), which indents your code
according to its logic.  The above fragment is turned by cb into

		if (sv > score);
		score = sv;

cb is particularly useful if you have macro functions, as these can easily
cause unexpected control-of-flow problems and are expanded on one long
line.  I often do
		
		cc -E prog.c | cb | cat -s

The -E flag just runs the preprocessor, and
the cat -s is to get rid of the masses of white space which lines like
"#include " cause.

				-- Tom Stockfisch