On 10-10-2012 14:05, Marco Leise wrote:
Am Thu, 04 Oct 2012 15:27:58 +0200
schrieb Alex Rønne Petersen <[email protected]>:

On 04-10-2012 15:21, Piotr Szturmaj wrote:
Jacob Carlborg wrote:
[…]
* For other struct sizes, the return value is stored through a hidden
pointer passed as an argument to the function.

I strongly advise ignoring the D calling convention. Only DMD implements
it and nowhere else than on Windows for 32-bit x86.

Instead, refer to the Windows and System V x86 ABIs.

The hidden pointer is exactly what I see MSVC++ produce for
struct returns (but even for 4 byte ones). e.g. "MyStruct
foo()" is equivalent to "foo(MyStruct&)"
I understand that the GCC people don't want to add YACC (yet
another calling-convention), but frankly Pascal got away with
a c-c of its own, too and I never heard anyone complain.
I mean aside from compiler implementations, what's the problem
with an own calling convention for D code calling D code if it
is more efficient?


The problem is ABI specification. Right now, you can't reliably write inline assembly in D because all the compilers use different calling conventions for extern (D).

Also, the Pascal calling convention is only supported by very few compilers today.

--
Alex Rønne Petersen
[email protected]
http://lycus.org

Reply via email to