Can we kill the D calling convention already?

Erik Jensen eriksjunk at rkjnsn.net
Tue Apr 24 09:05:51 PDT 2012


On Tuesday, 24 April 2012 at 14:40:05 UTC, Iain Buclaw wrote:
> On 24 April 2012 11:29, Alex Rønne Petersen 
> <xtzgzorex at gmail.com> wrote:
>> On 24-04-2012 11:42, Kagamin wrote:
>>>
>>> Speaking about GDC, you can't link to omf files directly - so 
>>> there
>>> shouldn't be any binary incompatibility.
>>> If the assembler code is unportable across compilers, it's a 
>>> developer's
>>> mistake or intention.
>>
>>
>> The point is just that: Right now I can write assembly that 
>> will work on
>> GDC, LDC, and DMD on non-Windows. It will not work for DMD on 
>> Windows.
>> Something has to change here.
>>
>> You're missing the point if you think this is a "developer 
>> mistake".
>>
>
> Is not just Windows, the DMD calling convention on Linux 
> differs from
> the system calling convention.  For example, some of the naked
> functions in std.math returning floating point values assumes 
> caller
> clean up.  Where as the C calling convention is callee clean up.

That is incorrect. The cdecl calling convention is caller 
clean-up (see 
http://en.wikipedia.org/wiki/X86_calling_conventions). Otherwise, 
variable argument functions would not be possible (the called 
function doesn't know what to clean up).




More information about the Digitalmars-d mailing list