home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.software-eng
- Path: sparky!uunet!spool.mu.edu!caen!uvaarpa!murdoch!murdoch.acc.virginia.edu!aj3u
- From: aj3u@onyx.cs.virginia.edu (Asim Jalis)
- Subject: Re: C code Layout
- In-Reply-To: rcd@raven.eklektix.com's message of Thu, 17 Dec 1992 08:14:51 GMT
- Message-ID: <AJ3U.92Dec17172600@onyx.cs.virginia.edu>
- Sender: usenet@murdoch.acc.Virginia.EDU
- Organization: University of Virginia, Charlottesville, VA 22903
- References: <KANZE.92Dec15171105@slsvdnt.us-es.sel.de> <1992Dec16.083733@eklektix.com>
- <MARTINC.92Dec16111734@hatteras.cs.unc.edu>
- <1992Dec17.081451@eklektix.com>
- Date: Thu, 17 Dec 1992 22:26:00 GMT
- Lines: 23
-
- I prefer the K&R style of using braces with statement blocks:
-
- keyword (condition) {
- statement1;
- statement2;
- statement3;
- }
-
- Two reasons:
-
- 1. The closing brace can be matched with the "if", "while",
- "for", or "do". There are so few keywords that it is easy to
- form visual associations quickly. Thus the argument that other
- bracing styles make it easier to match braces is not applicable.
-
- 2. The statement block appears physically connected with the
- keyword statement. With styles that leave a blank line between
- the conditional statement and the statement block a visual effect
- of two distinct objects is produced. It is easier to visualize
- associated code if it appears as a single contiguous object.
-
-
- Asim.
-