Using Constants in Headers

Started by
19 comments, last by the_edd 11 years, 4 months ago

So, should I put a namespace i.e. Constants:: around my constants, or would that be a waste of keystrokes?


A good rule of thumb, I think, is to put each constant in the same namespace as the subsystem/library/... it's associated with e.g.


// hypothetical example

namespace render
{
const float max_fov_degrees = 179.0F;

class camera
{
// ...
};

} // render


Putting all constants in the entire application in a single namespace feels to me like an attempt to cut concerns along an unusual axis.

This topic is closed to new replies.

Advertisement