Can we kill the D calling convention already?

Alex Rønne Petersen xtzgzorex at gmail.com
Wed Apr 25 10:51:42 PDT 2012


On 25-04-2012 19:44, mta`chrono wrote:
> Am 24.04.2012 10:42, schrieb Alex Rønne Petersen:
>> Writing portable code is hard enough as it is. Why do we have to have
>> some random, D-specialized calling convention (only on Win32 and only in
>> DMD)? The result of the current state of things is that extern(D) is
>> essentially useless - it has completely different meanings across
>> compilers. You cannot rely on it at all. If memory serves me right, both
>> LDC and GDC just alias it to extern(C), but DMD insists on using this
>> magical D calling convention on Win32.
>>
>> I'm not attacking the D ABI (name mangling) here, but I do think this
>> calling convention needs to either go away, or be optional (i.e. as some
>> extern() argument). We *have* to make extern(D) consistent across
>> compilers, or we'll be no better than the mess that is C and C++; we're
>> advertising a standard inline assembler with support for naked
>> functions, but that support is useless if we don't have a consistent
>> default calling convention.
>>
>
> Introducing a commen calling convention would be one approach. The other
> would be to templatize D's inline assembler?

All the big compiler back ends are not realistically going to implement 
some random calling convention because we tell them to.

-- 
- Alex


More information about the Digitalmars-d mailing list