extern(C) symbol conflicts

Artur Skawina via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 29 10:35:13 PST 2015


On 01/29/15 14:43, Steven Schveighoffer via Digitalmars-d wrote:
> I really think D should consider extern(C) functions as not overloadable,

All functions are overloadable in D; ie you can mix C and D overloads
freely; this is a feature. It allows you to extend the C i/f without
adding an extra layer of pointless wrappers. And export a subset of
the D i/f to other C-but-not-D-aware languages. Etc.

> and universally binding (i.e. it's not an error to have 2 identical definitions in separate modules,

External functions with identical signatures and identical mangled
names are obviously not conflicting, so that case does not need to
be an error, yes. But I suspect that, in practice, sticking to just
one declaration is a good idea anyway (the language changes with
every compiler release, so the signatures can easily get out of sync.
eg missing nothrow/@nogc/@return attributes).

artur


More information about the Digitalmars-d mailing list