|Re: The semicolon habit firstname.lastname@example.org (1995-05-10)|
|Re: The semicolon habit email@example.com (1995-05-11)|
|Re: The semicolon habit firstname.lastname@example.org (1995-05-15)|
|Re: The semicolon habit Paul_Long@ortel.org (1995-05-17)|
|Organization:||Australian National University|
|Date:||Mon, 15 May 1995 00:02:17 GMT|
email@example.com (Daniel J. Salomon) writes:
>The discussion was more about syntax than about syntax errors. Poor
>syntax can lead to errors that persist until run time. For instance in
>the C language, a programmer may become used to ending every line with
>a semicolon may absentmindedly write:
> while(x < 10.0);
>and not notice the error. There is no syntax error here, but this statement
>is almost certainly a run-time error.
To my mind this is a *semantic* rather than syntactic flaw in C. Indefinite
iteration in which you do nothing is semantically meaningless and the compiler
should flag it as an error. People will say "what about coding an infinite
loop that does ...". Answer: use a different semantic construct (eg. "forever
do"). Indeed almost all the quirky bugs you can get in C through "syntax
mistakes" occur because C's syntax does not adequately reflect the differences
in the underlying semantics of various constructions, chosing instead to use
the same syntax for different semantics ideas. And so you get into trouble.
[Keep in mind that if x is volatile, that's a reasonable thing to write.
It's a subtle issue. -John]
Return to the
Search the comp.compilers archives again.