[sword-devel] sword namespace

David White sword-devel@crosswire.org
01 Oct 2002 20:48:36 +1000

I'd just like to point out a few things on this:

- Firstly, I think it's a really good idea, and I think I suggested it a
while ago :)
- Some older or less conforming compilers might not know about or like
- You also might like to consider creating sub-namespaces, for instance
anything that is a utility, and is useful, but has no specific relation
to Bible software, could go in a namespace util, or utility. (say for
instance, string manipulation functions)
- Anything that is an implementation detail could go in a namespace
clearly marking it as such. For instance, I believe that Boost puts such
things in a namespace 'detail'
- Any symbols that are to be local to a translation unit should be
placed in an anonymous namespace
- It is recommended that library users only place "using" statements in
source files, not header files, and only after all #include statements.

I also recommend the following article for people interested in
namespace migration issues: http://www.gotw.ca/gotw/053.htm



On Tue, 2002-10-01 at 20:25, Daniel Glassey wrote:
> On 30 Sep 2002 at 11:38, Daniel Glassey sent forth the message:
> > Hi,
> > Does anyone strongly object to me putting the sword stuff into a 'sword' 
> > namespace?
> ok,
> the stuff is ready to go in and consensus afaict is that it is a good idea so I'll put it in this evening. I 
> just thought I'd give you advance warning because it will break current application code and old 
> compilers unless you use the backward compatibility define.
> so you if you want sword to not be in it's own namespace you have to define NO_SWORD_NAMESPACE 
> when you compile or use CVS sword.
> At the start of each header or source file after the #includes there is a macro 
> And at the very end there is SWORD_NAMESPACE_END
> Any new files must have these macros.
> oh, and I may have missed some though I made sure it compiles with and without 
> NO_SWORD_NAMESPACE so gimme a shout if you find anything.
> Regards,
> Daniel