namespace N
{
static int x = 5;
}
What could be the importance/use-cases of declaring having a static variable at namespace scope?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Annex D (Compatibility features) [C++03]
Use unnamed namespaces instead as mentioned in this post.
static keyword imparts internal linkage to variables/objects in C as well as in C++ in namespace scope as others have mentioned in their posts.
P.S:
Thie feature has been undeprecated as per the latest draft (n3290). In n3225
§7.3.1.1/2is present but striked out.