Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!seismo!mcvax!ukc!warwick!steve From: steve@warwick.UUCP (Steve Rumsby) Newsgroups: net.lang.c Subject: Re: questions from using lint Message-ID: <287@euclid.warwick.UUCP> Date: Mon, 12-May-86 06:13:17 EDT Article-I.D.: euclid.287 Posted: Mon May 12 06:13:17 1986 Date-Received: Thu, 15-May-86 06:05:21 EDT References: <501@brl-smoke.ARPA> <797@bentley.UUCP> Reply-To: steve@euclid.UUCP (Steve Rumsby) Organization: Maths Institute, Warwick University, UK Lines: 38 In article <797@bentley.UUCP> kwh@bentley.UUCP writes: >In article <501@brl-smoke.ARPA> rbj@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@uk.ac.warwick.daisy ARPA: steve%warwick.uucp@ucl-cs.ARPA BITNET: steve%warwick.uucp%uk.ac.warwick.daisy@uk.ac