Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Nested namespaces, go or no go?


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
2 replies to this topic

#1 incertia   Crossbones+   -  Reputation: 525

Like
0Likes
Like

Posted 26 October 2012 - 03:38 PM

Like the title states, is it a good idea to nest namespaces inside of each other (i.e. Foo::Bar::Baz::Qux(int n))?
Current project here

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 6772

Like
3Likes
Like

Posted 26 October 2012 - 03:46 PM

In principle, there's nothing wrong with it, just make sure that actually having different namespaces actually makes sense for the size and scope of the project. Ex: boost has a number of nested namespaces, but boost contains a large number of different libraries, many of which are completely unrelated to each other. On the other hand, if your entire program can fit in two source files, then nested namespaces are probably a bad idea.

#3 Radikalizm   Members   -  Reputation: 2059

Like
0Likes
Like

Posted 26 October 2012 - 06:51 PM

I like to use nested namespaces when working on a large project which can actually be divided in logical groups of code, like separating a math library from a rendering library found in a single project for example. It's not exactly necessary, but it can really help with maintaining an overview of your code.

But as SiCrane mentioned, it's not a good idea to use them for smaller projects.




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