On Monday, 6 October 2014 at 16:02:40 UTC, eles wrote:
On Monday, 6 October 2014 at 13:23:55 UTC, John Colvin wrote:
On Monday, 6 October 2014 at 12:16:14 UTC, eles wrote:
On Monday, 6 October 2014 at 11:54:56 UTC, John Colvin wrote:
On Monday, 6 October 2014 at 10:10:04 UTC, eles wrote:
On Saturday, 4 October 2014 at 15:29:57 UTC, John Colvin wrote:
On Saturday, 4 October 2014 at 11:19:52 UTC, ketmar via Digitalmars-d-learn wrote:
On Sat, 04 Oct 2014 11:01:28 +0000
John Colvin via Digitalmars-d-learn

This isn't a problem. You're not going to get the name-mangling right by accident. Even for free functions the module name is mangled in.

It is. I could erase the definition of an identical class in another .d file and accidentally leave an orphan definition method therein.

Unless I misunderstand you, this can't happen. Class methods are mangled to contain the module name and the class name. I can't think of a way of getting the same mangling and getting a bad substitution without either

a) pragma(mangle, ...)

or

b) you have 2 modules with the same name, containing classes with the same name, which you compile completely separately (to prevent the compiler complaining about the duplication), then link the results together. This would also work for free functions.

a) is a deliberate feature. b) has bypassed the compiler completely, there's no way it can know.

You're never going to do it by accident.

The only way this can happen is with extern(C) functions, which is because C doesn't mangle it's function names.

This too is a hole. Why to leave holes?

Because it's how C linkage works and if we're using extern(C), it means we want C linkage. That's the point of extern(C).

Reply via email to