Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: lint and volatile and const constructs Message-ID: <1252@haddock.ISC.COM> Date: Fri, 25-Sep-87 16:35:44 EDT Article-I.D.: haddock.1252 Posted: Fri Sep 25 16:35:44 1987 Date-Received: Sun, 27-Sep-87 03:05:40 EDT References: <832@ektools.UUCP> <279@apr.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Followup-To: comp.lang.c Organization: Interactive Systems, Boston Lines: 29 Keywords: lint volatile const c updating Xref: mnetor comp.unix.questions:4264 comp.lang.c:4543 In article <279@apr.UUCP> whp@apr.UUCP (Wayne Pollock) writes: >It is a bad idea to modify your source code (such as lint). The simpler >approach is to add a global include file: > #ifdef lint > #define volatile > ... > #endif If (as is traditional) lint is implemented as a shell script, then modifying the "source code" is trivial: search for "-Dlint"; add "-Dvolatile= -Dconst=". As has been mentioned, this doesn't handle warts like "const x=3;". >If you really need to modify lint, you must modify the yacc grammar which is >used for lint. As I recall, the semantics of volatile and const place them >in the "sc-specifier" class, just like register or auto. You recall incorrectly. At most one storage-class-specifier may be given in a declaration, but "auto const" and "static const" and "extern const" are all legal. As of the Oct86 dpANS const is a type-specifier like "int", but I've heard X3J11 is rewriting this part. Note also that a declaration such as "const char * const x" is legal, and does not mean the same thing as either "const char * x" or "char * const x". Of course, a REAL fix would not just ignore the new keyword; an ANSI lint should warn about a cast from const to non-const, or an apparent attempt to modify a const. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint (I have directed followups to comp.lang.c only)