Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: lint and volatile and const constructs Message-ID: <7479@elsie.UUCP> Date: Tue, 22-Sep-87 10:33:13 EDT Article-I.D.: elsie.7479 Posted: Tue Sep 22 10:33:13 1987 Date-Received: Thu, 24-Sep-87 04:43:28 EDT References: <832@ektools.UUCP> <6457@brl-smoke.ARPA> Organization: NIH-LEC, Bethesda, MD Lines: 31 Summary: The right way Xref: mnetor comp.unix.questions:4212 comp.lang.c:4484 In article <6457@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: > In article <832@ektools.UUCP> jim@ektools.UUCP (James Hugh Moore) writes: > >The Tektronix software supports const and volatile declarations for data. > >Well lint complains bitterly about these. > > lint -Dconst= -Dvolatile= sources.c Which will get the code past lint, and will leave you with code that isn't portable to sites with existing C compilers (for example, 4.[123]BSD sites). The better approach is a variant of one suggested by an earlier poster: handle the const/volatile vagaries in a header file. Suggested: #ifndef __STDC__ #define const #define volatile #endif /* __STDC__ */ Note that neither the command-line approach nor the header file approach will help if you have declarations such as const x = 3; in which const (or volatile) is the only keyword in the declaration. But from what I've been reading X3J11 may be moving in the direction of outlawing such declarations; they should be avoided. -- CC is a registered trademark of the Institute for Scientific Information, Inc. Lint is an Oscar Madison trademark. -- ado@vax2.nlm.nih.gov ADO, VAX, and NIH are trademarks of Ampex and DEC.