Jump to content

  • Log In with Google      Sign In   
  • Create Account

Using Constants in Headers


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#21 e‍dd   Members   -  Reputation: 2105

Like
0Likes
Like

Posted 26 November 2012 - 02:47 PM

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.

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS