extern(C++, NS)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 30 09:38:05 PST 2015


On 11/30/2015 2:26 AM, Ola Fosheim Grøstad wrote:
> I wish someone would shed som light on this as inline namespaces is what
> libraries will use in the future in order to do versioning and  target different
> architectures, the one marked "inline" is made active and can be directly
> accessed through "X::decl" or "X::version1::decl" in c++:
>
> namespace X {
>       inline namespace version1 {
>            decl....
>       }
>       namespace version2 {
>            decl....
>       }
> }
>
> Seems to me that D needs to embed clang and that the current bindings-only
> approach will not survive C++11 and later standards.


It'd be worthwhile to learn how D's name lookup system works before declaring it 
lame and insufficient:

   extern (C++, X) {
         extern (C++, version1) {
                 enum e = 3;
         }
   }

   int x = e;
   int y = X.e;
   int z = X.version1.e;

compiles successfully.


More information about the Digitalmars-d mailing list