Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site cyb-eng.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!ut-sally!cyb-eng!bc From: bc@cyb-eng.UUCP (Bill Crews) Newsgroups: net.lang.c Subject: Re: C Bites Message-ID: <741@cyb-eng.UUCP> Date: Wed, 9-Oct-85 13:49:08 EDT Article-I.D.: cyb-eng.741 Posted: Wed Oct 9 13:49:08 1985 Date-Received: Sat, 12-Oct-85 18:24:27 EDT References: <1963@brl-tgr.ARPA> Organization: Cyb Systems, Austin, TX Lines: 46 > > > Why do you like this style? This seems to indicate that > > >the braces are associated in your mind with the enclosed statements. > > > > You seem to have answered your own question. What else are the braces related > > to if not the enclosed statements? Note the following, which has nothing to do > > with if's, while's, for's, or do's. > > > > main() > > { > > int i = 42; > > float foo = 3.14159; > > > > printf("Starting program\n"); > > printf("i = %d, foo = %f\n",i,foo); > > > > { /* Truly local variables */ > > static char *foo = "What is the meaning of life?"; > > double i = 1.414; > > > > printf("Another message\n"); > > printf("i = %f, foo = %s\n",i,foo); > > } > > /* Back to the old variables */ > > > > printf("Yet another message\n"); > > printf("i = %d, foo = %f\n",i,foo); > > exit(0); > > } > > How many people axually do this? I mean use nested blox? Most people use > braces only where necessary. > > jim cottrell@nbs Do I understand you to say that, because a language construct is not often used, one should pretend it isn't part of C and use a conflicting conceptual model? Come on! Besides, it is used every time you have an if, while, do while, or for followed be a compound statement (a block); AND ever time you define a function. Let's not quibble over whether some variables happen to be declared or not. -- / \ Bill Crews ( bc ) Cyb Systems, Inc \__/ Austin, Texas [ gatech | ihnp4 | nbires | seismo | ucbvax ] ! ut-sally ! cyb-eng ! bc