External constants (was: Does extern "const" allocate storage?)
Robert Lenoil
lenoil at Apple.COM
Sat Mar 19 09:51:39 AEST 1988
In article <3034 at haddock.ISC.COM> karl at haddock.ima.isc.com (Karl Heuer) writes:
>>Does
>> extern const int foo;
>>expect to be linking to an external constant, or is it linking to an external
>>integer, and semantically prohibiting assignment to that integer?
>
>What do you mean by "linking to an external constant"?
Forgive me for lapsing into 8088 assembler, but it's the easiest way to
answer this:
public foo ;give foo extern scope
foo dw 3 ;foo is an external int
foo equ 3 ;foo is an external constant
In the first example, the address of foo is made public. In the second, foo
is a constant and its value (3) is made public, i.e. foo is an external
constant.
More information about the Comp.lang.c
mailing list