Braces are not Compiler-Fluff.

John Mundt john at chinet.chi.il.us
Thu Dec 29 02:41:15 AEST 1988


In article <849 at unh.UUCP> jeff at unh.UUCP (Jeffrey E. F. Friedl) writes:
>
>In article <272 at twwells.uucp> bill at 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

I agree that braces are needed as cues and would add the following:

Perhaps this has been covered in an earlier response, but braces are
the only unambiguous way the compiler would have of telling indentations
given that different people use different amounts of indentation.  I
use vi with tabstop=4, and others use tabstop=8.

At times, code being moved from one machine to another gets the tabs 
expanded into 8 spaces.  If a person takes the time to do a 

	g/        /s//^I/g
          ^^^^^^^^ /* eight spaces */

all will be well, but if not, and a small piece of code is inserted,
the compiler will be faced with a mix of spaces and tabs and would 
have a heck of a time figuring out what indentation was meant.
Without the braces, there would be nothing visible to show the problem.

And finally, vi allows you to use the "%" command to see if you have
braces matched.  With lots of code ending in

						...
					}
				}
			}
		}
	}
}

or worse, the braces come in mighty handy.  
-- 
---------------------
John Mundt   Teachers' Aide, Inc.  P.O. Box 1666  Highland Park, IL
john at chinet.chi.il.us
(312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem  



More information about the Comp.lang.c mailing list