Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Using Constants in Headers

4: Adsense

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   

2109
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.




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.