Does extern "const" allocate storage?

Karl Heuer karl at haddock.ISC.COM
Wed Mar 23 08:24:51 AEST 1988


In article <613 at mcrware.UUCP> jejones at mcrware.UUCP (James Jones) writes:
>In article <3034 at haddock.ISC.COM>, karl at 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 at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list