POV-Ray : Newsgroups : povray.beta-test : Beta 37 and C++0x : Re: Beta 37 and C++0x Server Time
5 Oct 2024 17:18:03 EDT (-0400)
  Re: Beta 37 and C++0x  
From: Edouard
Date: 2 Jun 2010 18:15:01
Message: <web.4c06d79ce947f53b3694f4200@news.povray.org>
"Fredrik Eriksson" <fe79}--at--{yahoo}--dot--{com> wrote:

> The point of namespaces is to prevent name collisions in code that uses
> several libraries (in this specific case, Boost and the standard library).
> Importing whole namespaces destroys that benefit, particularly when done
> at namespace scope.

The point of namespaces is to give you tools to *manage* namespaces. If all you
wanted was a way of naming things differently, then C++, pre-namespace, already
gave you ways of doing that.

one example being:

struct std { class cout { ... }; class endl { ... }  };
std::cout << blah() << std::endl;

Namespaces are more than just another scoping qualifier. The whole point of
namespaces is that they give you access to the using statement (with differing
levels granularity, and with aliasing). If all you use namespaces for is to add
an additional scoping qualifier, that you then use in full everywhere in your
code, than you're not really using them properly.

Cheers,
Edouard.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.