Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekcrl!tekfdi!videovax!dougs
From: dougs@videovax.tv.Tek.com (Doug Stevens)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Spurious Turbo-C warning -- how do I get around it?
Summary: A word on programming style (somewhat long)
Message-ID: <5559@videovax.tv.Tek.com>
Date: 25 Sep 89 23:05:36 GMT
References: <5554@videovax.tv.Tek.com> <6913@stiatl.UUCP> <7024@stiatl.UUCP>
Distribution: usa
Organization: Tektronix TV Measurement Systems, Beaverton OR
Lines: 35

As the author of the original query, I think this discussion has generated
more heat than light. My original point was how to suppress a spurious
warning, the point being that I was trying to achieve an error-free,
warning-free compilation.

My contribution to the 'heat' regarding programming style: 
most of the suggestions I've received about 'improving' the style have
their own style drawbacks. Many suggested using 

	break;

to exit the loop; I have always regarded 'break' as a very thinly disguised
'goto'. If you're a fan of Duykstra's (spelling?), you avoid everything 
but while() and if() statements; even for(;;) is frowned upon, because
it is easily reduced to while().

Some situations seem to screw up even the best intentions toward good style 
(eg, error handling at the lowest level of communication or file-handling 
calls). I get caught up in style considerations to this extent:

	(1) Can someone who is new to the code understand and successfully
	modify it on the first viewing? Are the modules small enough to
	grasp? Do the names make sense? Are there side effects buried in
	conditional statements? Etc, etc, etc.

	(2) Can you prove (to an unbiased observer) that the code works?
	(No, I don't mean formal proof; I mean will any reasonable
	professional accept the argument).

I would suggest to anyone interested in improving programming style to
read 'Elements of Programming Style' (by Kernighan and Ritchie, I believe.
If you want to see what inspired them, read 'Elements of Style' by
Shrunk and White).

Sorry this is so long.