Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!cottrell@nbs-vms.ARPA From: cottrell@nbs-vms.ARPA Newsgroups: net.lang.c Subject: C bites Dog! Message-ID: <872@brl-tgr.ARPA> Date: Wed, 21-Aug-85 20:10:37 EDT Article-I.D.: brl-tgr.872 Posted: Wed Aug 21 20:10:37 1985 Date-Received: Sat, 24-Aug-85 17:26:35 EDT Sender: news@brl-tgr.ARPA Lines: 53 /* > > > ???: > > > if (sv > score); <----- note extraneous semi-colon > > > score = sv; > > Doug Gwyn: > > This sort of thing makes me think that a few extra keywords > > are called for programming languages like this. E.g. > > ifthen fi > > while do od > > Something to keep in mind when you design an Algol-like language. > > ICK ICK ICK! I hate languages that do that. Ever considered using "cb" as a > debugging tool? I have an MS-DOS version if anyone wants it... > -- > Peter da Silva (the mad Australian werewolf) > UUCP: ...!shell!neuro1!{hyd-ptd,baylor,datafac}!peter > MCI: PDASILVA; CIS: 70216,1076 Dear Peter, Welcome to the `Let's Disagree with Doug' club! Unfortunately, I am forced to agree with him here. CB (& INDENT) is A Good Thing, but since I am such a wonderful coder (:-) I rarely use them. What they really are useful for is importing code written by cretins. Also, I probably disagree slightly with the output of those formatters. What would you do, compare the output of `cb' with the original? Takes lots of time & can be visually overlooked. Anyway, to get back to the point, you come to realize that in if then else fi the parens around are unneccesary. And the `fi' makes sure that all the elses nest with the correct `if'. The Bourne shell has the following definitions, (which many peole dislike, but I think they're OK) #define IF if( #define THEN ){ #define ELSE }else{ #define FI } The point is, you need at least 4 tokens (or a `one-statement' model) to delimit the three parts of an `if' from each other and the outside. C uses four (not counting semicolons)in the short form (if (e) s1; else s2;) and eight in the long form (if (e) { s1; } else { s2; }). And let's get rid of those semicolons too! A newline should imply one. Two statements on a line would need an explicit one. An escaped newline would continue to the next line. Yeah, I know, write my own language! jim cottrell@nbs */ ------