[Issue 17748] extern(C) do nothing on struct methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 17 12:29:15 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17748

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at dawg.eu

--- Comment #7 from Martin Nowak <code at dawg.eu> ---
https://dlang.slack.com/archives/C1ZDHBB2S/p1508243056000454

IIUC, `extern(C)` is simply ignored for non-static member methods atm., neither
changes mangling nor the method ABI.
The only case where that is helpful is with blunt struct scope `extern(C)`.

```struct S
{
extern(C): // just everything
    static void foo()
    {
    }

    float foo(int a, float b)
    {
        return a + b;
    }
}
```

At a first look it seems reasonable to deprecate using `extern(C)` on
non-static member methods, and require people to rewrite above code to

```struct S
{
    extern(C) static void foo()
    {
    }

    float foo(int a, float b)
    {
        return a + b;
    }
}
```
.

Static methods should support extern(C) calling convention, and in that case it
seems reasonable to stick with the current behavior, to only affect the calling
convention, but not the mangling.

--


More information about the Digitalmars-d-bugs mailing list