Related articles |
---|
Semicolons (Re: Low-Rent Syntax) bart@videovax.tv.tek.com (Bart Massey) (1990-08-13) |
Re: Semicolons (Re: Low-Rent Syntax) codex!peterd@uunet.UU.NET (1990-08-20) |
Semicolons (Re: Low-Rent Syntax) thomasm@llama.ingres.com (1990-08-22) |
Re: Semicolons (Re: Low-Rent Syntax) trt@rti.rti.org (1990-08-24) |
Re: Semicolons (Re: Low-Rent Syntax) mjr@decuac.DEC.COM (1990-08-25) |
Re: Semicolons (Re: Low-Rent Syntax) bart@videovax.tv.tek.com (Bart Massey) (1990-08-26) |
Re: Semicolons (Re: Low-Rent Syntax) elsie!ado@uunet.UU.NET (1990-08-27) |
Re: Semicolons (Re: Low-Rent Syntax) anw@maths.nott.ac.uk (1990-08-29) |
Re: Semicolons (Re: Low-Rent Syntax) liam@cs.qmw.ac.uk (1990-09-03) |
Re: Semicolons (Re: Low-Rent Syntax) firth@sei.cmu.edu (1990-09-05) |
[6 later articles] |
Newsgroups: | comp.compilers |
From: | trt@rti.rti.org (Thomas Truscott) |
Summary: | The real problem is the compiler, not the language |
Keywords: | C, design, debug |
Organization: | Research Triangle Institute, RTP, NC |
References: | <9008202341.AA06543@llama.ingres.com> |
Date: | 24 Aug 90 01:40:41 GMT |
> > while( x );/* a nasty case */
> > x--;
>
> The real problem here is not with the semicolon, it is with the grammar
> production that dominates C and Pascal:
The problem is with the compiler that fails to issue warnings about the
obvious problems with the above code:
prog.c: line 12: degenerate "while" loop
prog.c: line 13: dubious indentation level.
Tinkering with language syntax can go only a short distance towards
stamping out the bugs that typical code contains. Syntax restrictions
would be hard put to catch bugs such as:
prog.c: line 20: variable "i" may be used before set
p = malloc(strlen(s));
^
prog.c: line 32: was "strlen(s) + 1" intended?
I believe this type of diagnostic assistance, fueled by examples of
typical errors, is far more effective than adding syntactic handcuffs. I
was quite surprised to learn, this evening, of a C compiler that actually
does this level of diagnostic analysis. (Along with convenient options to
control the degree of nit-picking). Perhaps if it becomes widely
available (and demanded), compilers for other languages will do it too, to
catch errors such as:
while ( x )
y--;
endwhile;
Tom Truscott
[Which compiler is it? And when I really do want to write a degenerate
while loop, how do I tell it not to complain? -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.