Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!driehuis%hlerul5.BITNET@Berkeley From: driehuis%hlerul5.BITNET@Berkeley Newsgroups: net.lang.c Subject: Re: Re: Re: C bites (Null loop-bodies) Message-ID: <1066@brl-tgr.ARPA> Date: Wed, 28-Aug-85 14:22:45 EDT Article-I.D.: brl-tgr.1066 Posted: Wed Aug 28 14:22:45 1985 Date-Received: Fri, 30-Aug-85 01:26:38 EDT Sender: news@brl-tgr.ARPA Lines: 31 Gary M. Samuelson writes: >> I put null loop-bodies on a separate line like in the following >> example. >> >> while (eatup() != '\n') >> ; > >Putting the semi-colon on a separate line does help make it clear >that the body of the loop is intentionally null, but what I like >even better is: > > while( eatup() != '\n' ) > continue; > >Comments? Yes. I am not fond of using continue if it is not necessary to do so. All loop-modyfying statements require an additional effort to read - at least, for me. Neither do I like the suggesion I saw in info-c, that read something like > while (function() != READY) { > } The reason why is quite prosaic: when I edit an existing file into something else, with cutting, pasting, and deleting, sometimes (no more than once a week :=)) a line or even a block of text gets lost, leaving embraced white space. My first reaction to seeing braces, embracing nothing, is: oops... been too hastily with the delete-line key. The convention to use a period on a line by itself is sufficient to recognise at first sight: "this is a null statement".