Where would you put global constants in a C++ application? For example would you put them in a class? In a struct?
Share
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.
I would use a namespace for global constants which are not very strongly associated with a single class. In the latter case, I would put them in that class.
Really global (application-level) constants should be in the application’s namespace (provided your application is inside it’s own namespace, as it should be). For module-level constants, the module’s own namespace is the natural place.