kpovmodler in kdegraphics error

Daveed Vandevoorde kpovmodeler-devel@mail.kde.org
Mon, 3 Feb 2003 12:01:28 -0500


> On Thursday 30 January 2003 09:54, Sylvain Joyeux wrote:
>>> Const char* const means that the characters are constant and the 
>>> pointer
>>> is constant (the second const).
>>
>> I meant: why the symbols are no more made public by the compiler ?
>
> Maybe because it is a real constant? const char* can be modified, so 
> it is a
> variable. It doesn't make sense to export constants.

In C++ const declarations have internal linkage by default.
So,
	X const x;
is essentially equivalent to
	static X const x;

You can override this default linkage using the "extern" keyword:
	extern X const x;
(where X could be "char const*").

Your guess as to the motivation is essentially correct:
If a variable has internal linkage, it is easy to determine
it has not been address-exposed, and as a result not to
allocate static storage for it.  With external linkage,
you'd need to do some sort of whole-program analysis.

	Daveed