questions from using lint

Steve Rumsby steve at warwick.UUCP
Mon May 12 20:13:17 AEST 1986


In article <797 at bentley.UUCP> kwh at bentley.UUCP writes:
>In article <501 at brl-smoke.ARPA> rbj at icst-cmr (Root Boy Jim) writes:
>>I have ranted about C using a one statement model for its control
>>statements instead of an explicit end statement.  Compound statements are
>>bounded by braces instead.  Yuk!
>
>Ah yes, there are two major types of language in the structured family;
>f77 with "endif" (some members use "end" for all of "endif", "endwhile",
>etc.) and pascal with "begin" "end" (which C abbreviates to "{" "}").  I
>presume this is what you dislike.  (If it's the spelling that bothers you,
>I'm sure you're aware that you can define "begin" and "end" as macros.)
>
>Yet another convention, not endorsed by any language I know, is to dispense
>with the braces and let the indentation alone tell the compiler how to
>interpret the program.  (I came up with this idea after an argument on the
>"correct" place to put the braces.)
>
Occam uses this model to delimit its blocks. It's a nice idea - no more
adding {/} around an if's "then" or "else" part simply because you've
changed it from one statement to two. Consistency like this can save a
lot of time looking for missing braces, etc. However, you do have to be
*very* careful with the space bar. One space in the wrong place can
also be a bit irritating to find, especially if you can't use vi/emacs
to match them for you like you can with {/}!

Couldn't you write a small(?) filter which would let you write C
without braces and fill them in for you from the indentation? It
doesn't seem too difficult. (No I'm not offering to do it).

					Steve.

-- 
Steve Rumsby.

UUCP:	...!ukc!warwick!steve
JANET:	steve%warwick.uucp at uk.ac.warwick.daisy
ARPA:	steve%warwick.uucp at ucl-cs.ARPA
BITNET:	steve%warwick.uucp%uk.ac.warwick.daisy at uk.ac



More information about the Comp.lang.c mailing list