[webkit-dev] static const
Yong Li
yong.li at torchmobile.com
Wed Sep 2 17:12:02 PDT 2009
MSDN also has such statement: "const" global variables in C++ is implicitly
static, where it's implicitly extern in C. For "extern const", the module
that contains a initializer "extern const int bar = foo;" is the owner of
the object.
re: Albert J. Wong:
I also use "static const" for function scope variables. Thanks for the
experiment.
-Yong
----- Original Message -----
From: "Alexey Proskuryakov" <ap at webkit.org>
To: "Darin Adler" <darin at apple.com>
Cc: "WebKit Development" <webkit-dev at lists.webkit.org>
Sent: Wednesday, September 02, 2009 12:55 PM
Subject: Re: [webkit-dev] static const
>
> 02.09.2009, в 9:32, Darin Adler написал(а):
>
>>> As an aside, is there any practical difference between "static const"
>>> and "const" in C++? The only difference I'm aware of is that the former
>>> is deprecated in the standard.
>>
>> I believe the former gives internal linkage and the latter external
>> linkage, so I always use the former for things defined in a source file
>> and not declared in a header file and the latter for things defined or
>> declared in a header file.
>
>
> I don't have a normative reference at hand, but I'm fairly sure that both
> give internal linkage in C++ (unlike in C).
>
> http://stackoverflow.com/questions/998425/why-does-const-imply-internal-linkage-in-c-when-it-doesnt-in-c
> http://bytes.com/topic/c/answers/62013-const-has-internal-linkage-c
>
> - WBR, Alexey Proskuryakov
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
More information about the webkit-dev
mailing list