Does extern "const" allocate storage?

James Jones jejones at mcrware.UUCP
Sat Mar 19 02:26:49 AEST 1988


In article <3034 at haddock.ISC.COM>, karl at haddock.ISC.COM (Karl Heuer) writes:
> Let's assume we're talking about a header file that is shared among multiple
> modules.  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?  As nearly as I can tell, "const" doesn't *really* mean
"constant," it means "readonly" (which makes me wonder why the Committee
chose such a highly misleading name for it).  An example the Draft gives is
of a variable that might represent a memory-mapped input port that cannot
be assigned to (though, to be sure, that is declared "const volatile.")

		James Jones



More information about the Comp.lang.c mailing list