Path: utzoo!attcan!uunet!unh!jeff From: jeff@unh.UUCP (Jeffrey E. F. Friedl) Newsgroups: comp.lang.c Subject: Braces are not Compiler-Fluff. Summary: use them to your advantage Message-ID: <849@unh.UUCP> Date: 27 Dec 88 08:32:18 GMT References: <272@twwells.uucp> Organization: University of New Hampshire, Durham, NH Lines: 47 In article <272@twwells.uucp> bill@twwells.uucp (T. William Wells) writes: > > I believe ... > that braces exist only to make the compiler happy and should > therefore be as unobtrusive as possible. Several people have said this and I disagree. I suppose that it's a matter of opinion, but to me braces are part of the C language and as such I use them extensively as cues (that's "cues", not "crutches") when reading code. It's been said that "indentation is enough to show the block structure". Sure, but taking this idea to an extreme, one could say that having all the pages in a book is sufficient to determine what page you're on -- one doesn't need page numbers. > [braces glued to a control structure are] sometimes necessary for > the compiler (but I always use the braces), but contributing little or ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ > nothing to the understandability of the program. The indentation of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > the program is what tells you the control relationships; the braces > are redundant information, at best they can augment what the > indentation is already telling you. If they contribute little or nothing, why put them when you don't need them (as you also said you do)? Yes, they are redundant, but going back to my (extreme) example above, page numbers in a book are redundant because you can count pages from the beginning to see where you are. It's just easier to see it right there (by the page numbers, or the braces -- both of which augment what you're already able to find determine). The only reason I say any of this is that if style is going to be discussed in a rational fashion (i.e. not a Religious FlameFest) then I think it's better to discuss braces from the point of view of "how can I use these braces to make things more readable" rather than from the point of view of "where can I stash these things". *jeff* ------------------------------------------------------------------------------ Jeffrey Eric Francis Friedl Box 2173 Babcock House ..!{uunet,decvax}!unh!jeff Durham New Hampshire 03824 I hope I'm not around Jan 18, 2038 at 10:14:08PM