Why extern variables and functions within template/struct/class have a D mangling

Dicebot m.strashun at gmail.com
Wed May 8 02:47:54 PDT 2013


On Wednesday, 8 May 2013 at 09:46:00 UTC, Andrej Mitrovic wrote:
> On 5/8/13, Dicebot <m.strashun at gmail.com> wrote:
>> static methods are illegal in C++ with extern(C) too.
>
> I don't see why. They're useful in D anyway.

Because they have namespace (class namespace) and can't be 
mangled according to C rules. Exactly your example. You can't 
have two "foo"'s there but any other naming scheme IS NOT C 
mangling but some weird abomination that pretends to be it. Thus 
it is a compile-time error.


More information about the Digitalmars-d mailing list