Namespaces in C++/CLI


Regarding the comment made about my Alternative to Directory.GetFiles and co. entry:


When is the nested namespaces being fixed in managed c++? That hack of doing it is just ugly to avoid the even uglier nesting. When is it going to be like
namespace Microsoft::Services::Partners::ISV ??


 


Ronald Laeremans, the Visual C++ Group Program Manager, sent me that feedback:



  • In the CLR nested namespaces as a concept do not exist. They are just a single namespace with dots in there.
  • I don’t personally know of any fundamental difference between C ++ and C# in what nesting of name spaces implies apart from more flexibility in C++ to distinguish between a global rooted identifier and one in the current context
  • We didn’t “fix” the namespaces since the explicit intent for the release was not to “fix” standard C++ and there is nothing special for .NET namespaces and standard C++ does not allow one to define multiple nesting levels at once.
  • There is a proposal pending for standard C++ to allow re-opening a namespace declaration like this, but not to allow introducing one with this syntax.

 


Dankje Ronald.


 

Comments (1)

  1. Carlos Ibarra says:

    Microsoft should at least fix

    xsd.exe /c /l:cpp /namespace:Microsoft::Services::Partners::ISV schema.xsd

    to produce valid C++:

    namespace Microsoft { namespace Services {…

    …}}}}

    and not

    namespace Microsoft::Services::Partners::ISV {

Skip to main content