Static data member in a class(in C++) will be considered as internal linkage or external linkage ? I did google but couldn't find out anything concrete for static member variables.
They have external linkage. See http://msdn.microsoft.com/en-us/library/zbh4586z.aspx (thanks Raymond !).
static
has several different meanings depending on context... That's the committee being stingy with keywords :) –
Ainsworth I was also interested in this question recently, and I found this in N4659 (Some draft of C++17):
§ 6.5.5 In addition, a member function, static data member, a named class or enumeration of class scope, or an unnamed class or enumeration defined in a class-scope typedef declaration such that the class or enumeration has the typedef name for linkage purposes (10.1.3), has the same linkage, if any, as the name of the class of which it is a member.
So static data member can have internal or external linkage, decided by the class itself. For example, static data member of a class in unnamed namespace should have internal linkage.
© 2022 - 2025 — McMap. All rights reserved.
static
declared non-class variables. Very misleading.. – Colpotomy