Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!dcl-cs!gdt!gdr!exspes From: exspes@gdr.bath.ac.uk (P E Smee) Newsgroups: comp.lang.c Subject: Re: Compilers and programming style (was Re: A question of style) Message-ID: <1989Dec22.100135.2903@gdt.bath.ac.uk> Date: 22 Dec 89 10:01:35 GMT References: <547@mars.Morgan.COM> <1989Nov30.001947.14883@aqdata.uucp> <427@jhereg.Minnetech.MN.ORG> <31884@news.Think.COM> <490@nixba.UUCP <564@mwtech.UUCP> Reply-To: exspes@gdr.bath.ac.uk (P E Smee) Organization: University of Bristol c/o University of Bath Lines: 38 In article <564@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: >In article <1989Dec18.113539.10935@gdt.bath.ac.uk> exspes@gdr.bath.ac.uk (P E Smee) writes: > >>though, that someone could put a heuristic into the compiler so that it >>would be rejected if it is being used because it is 'flash' rather than >>because it wins something in the context. :-) > >Compiler writers look: His smiley tells, he doesn't really mean it! Well spotted. Well, really I was only *half* kidding, but Martin is right, the compiler is not actually the place. See below. >There should be other tools than the compiler, to control programming >style, from 'intelligent' beautifiers to proprietary style checkers, >but *please* leave the compiler to what K&R and ANSI allows. Yep. The compiler should allow anything which is presently legal. If it wants to include 'do you really mean it' heuristics, they should only be applied if you ask for them with some special control argument, and the default should be not to use them. (Actually, though, I'd rather see them in something like an expanded and improved lint, or a totally new 'is-this-sensible' language checker. How about, maybe, 'cstyle', by analogy with 'style'?) A compiler should *never* of its own choice put out gratuitous warnings about valid constructs, as many places will not allow release of code unless it compiles with NO messages at all; and because a compiler which forces you to ignore chatty messages will someday lead you to miss an important one. I do think, though, that a compiler which will accept code written to either of 2 standards (say, K&R-1 and ANSI, or FORTRAN 66 and FORTRAN 77, or whatever) should provide a set of switches so that you can ask it to enforce compliance with whichever one you prefer. -- Paul Smee, Univ of Bristol Comp Centre, Bristol BS8 1TW, Tel +44 272 303132 Smee@bristol.ac.uk :-) (..!uunet!ukc!gdr.bath.ac.uk!exspes if you MUST)