often in headers I see
//global namespace, not in class
static const int my_global =1984;
but recently I learned that const implies internal linkage, so I wonder doesnt that make static unnecessary?
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.
It depends. In C++, it’s unnecessary, but some people (myself included) like to put it in, on the grounds of saying what we mean. And of course, if the header is to be used in C as well, it is necessary (but for many uses in C, you’ll need a
#define).