Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Nested namespaces useless typing?

$
0
0
Do you think that C++ api structured by nested namespaces are a good thing? Or do you see its just useless typing and it should rather have a prefix or something? Or do you think that one or two levels are just fine? What do you think? I personally think that C++ namespaces are there to prevent conflicts between other api´s and for nothing else. But for medium to large size api´s one nested level is fine. Too long: my::IO::Path::Combine(my::IO::Path::GetHome(), my::IO::Path::ExtractFileName(...)); Fine: my::Paths::CombinePath(my::Paths::GetHomePath(), my::Paths::ExtractFileName(...)); Better (using namespace my): Paths::CombinePath(Paths::GetHomePath(), Paths::ExtractFileName(...));

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>