Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Does extern "const" allocate storage? Message-ID: <3117@haddock.ISC.COM> Date: 22 Mar 88 22:24:51 GMT References: <7712@apple.Apple.Com> <3034@haddock.ISC.COM> <613@mcrware.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 12 In article <613@mcrware.UUCP> jejones@mcrware.UUCP (James Jones) writes: >In article <3034@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: >>If you use "static int const foo=3;" and never take its address, a good >>compiler ought to be able to inline it wherever it's used. > >Is this really true [since "const" really means "readonly", not "constant"]? An object which is declared const but not volatile can never be modified by a correct program. A conforming implementation is allowed to take advantage of this knowledge, by putting it in read-only memory and/or by inlining it. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint