Where would you put global constants in a C++ application? For example would you put them in a class? In a struct?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With