C Bites

Bill Crews bc at cyb-eng.UUCP
Thu Oct 10 03:49:08 AEST 1985


> > >	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 at 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



More information about the Comp.lang.c mailing list