Re: Do you currently use namespaces?
- Posted by ken mortenson <kenneth_john at ya?o?.com> May 26, 2008
- 987 views
Matt Lewis wrote: > > In addition, if you use namespaces, you can forget the fact 100% that > > anything > > is global throughout the entire program. For instance: > > Almost. Sort of. You can still get in trouble [theoretically] with > multi-file libraries. If, say win32lib (not picking on it, just that's > it's the most popular multi-file library out there) had naming conflicts > within other files that were part of the library (w32foo.ew and w32bar.ew), > you would have to include those and add a namespace in addition to including > win32lib. I doubt anyone has ever encountered this exact problem, but > someone on the internet was wrong again. :) It's rather pleasant to have my intuition confirmed so quickly. With regard to usage. Are we looking at the use of namespaces being sort of all or nothing? I'm not saying it would be a requirement, but once you start leaning on namespaces to solve collisions, you would tend to have every include be given a name? Will there be instances where you didn't give an include a namespace and find that later you must? Like adding a new lib to your project? This may not be a top level include, requiring a hunt through who knows how many files (depending on project size.) While the usage may be consistant, you might have an issue with consistant usage? I suspect I'm not being clear.