Parenthesis

Walter Bright newshound at digitalmars.com
Thu Dec 28 17:13:31 PST 2006


NN wrote:
> What about removing unuseful parenthesis in 'if', 'for', 'while' ?

Because having redundancies in the syntax helps prevent bugs such as the 
following:

> As told by Fred Webb in alt.folklore.computers in 1990:
> 
> |  I worked at Nasa during the summer of 1963.  The group I was working
> |  in was doing preliminary work on the Mission Control Center computer
> |  systems and programs.  My office mate had the job of testing out an
> |  orbit computation program which had been used during the Mercury
> |  flights.  Running some test data with known answers through it, he was
> |  getting answers that were close, but not accurate enough.  So, he
> |  started looking for numerical problems in the algorithm, checking to
> |  make sure his tests data was really correct, etc.
> |
> |  After a couple of weeks with no results, he came across a DO
> |  statement, in the form:
> |       DO 10 I=1.10
> |  This statement was interpreted by the compiler (correctly) as:
> |       DO10I = 1.10
> |  The programmer had clearly intended:
> |       DO 10 I = 1, 10
> |
> |  After changing the `.' to a `,' the program results were correct to
> |  the desired accuracy.  Apparently, the program's answers had been
> |  "good enough" for the sub-orbital Mercury flights, so no one suspected
> |  a bug until they tried to get greater accuracy, in anticipation of
> |  later orbital and moon flights.  As far as I know, this particular bug
> |  was never blamed for any actual failure of a space flight, but the
> |  other details here seem close enough that I'm sure this incident is the
> |  source of the DO story.



More information about the Digitalmars-d mailing list