On 5 April 2012 11:28, Alex Rønne Petersen <xtzgzo...@gmail.com> wrote: > On 05-04-2012 12:16, Dmitry Olshansky wrote: >> >> On 05.04.2012 13:49, Alex Rønne Petersen wrote: >>> >>> Hi, >>> >>> It is no secret that DMD is the only compiler in existence that follows >>> the "D" calling convention (and even then, only on some platforms, >>> seemingly?). >> >> >> IMHO It's the only sane convention I've seen. C's default of caller-side >> cleanup adds nothing but a mess for years to clean up. And code size >> bloat for no good reason. I think it was just a "cool trick" to make >> printf work, bleh. And extern(D) still allows that. > > > Right. I won't deny that the "D" calling convention is good, but supporting > it is not practical. > > >> >> Both GDC and LDC use the C calling convention of the >>> >>> platform by default (and don't even have options to use the "D" calling >>> convention because their back ends don't support it at all). >>> >>> I'm writing a virtual machine. As far as I am concerned, the "D" calling >>> convention adds nothing but complexity to the configuration support >>> matrix. The calling convention situation across platforms is already >>> utterly insane enough as it is. I would not have a problem with >>> supporting the "D" calling convention if all compilers followed it. But >>> they don't. And it is only specified for x86. Even in an ideal world, >>> the "D" calling convention won't exist everywhere because it isn't >>> intended to. >>> >>> So yes, we could just say "but eventually, those compilers should >>> support it!". >> >> >> Yup, let's stop being kids and copying whatever big ones are doing. >> Standards sort of happen like this: people just start doing things >> differently, then others like it and follow suit and then it's all >> written on a bunch (virtual) paper with ISO number somewhere. > > > Good luck convincing the GCC guys to merge your D ABI patch. ;) >
They were equally mortified when I mentioned 'naked' functions. :~) Point 2: If I were to be picky, the spec says that the extern (C) and extern (D) calling convention matches the C calling convention used by the supported C compiler on the host system. Except that the extern (D) calling convention for Windows x86 is described here. So as far as I am concerned GDC follows the specification of the D language to the letter, except maybe for Windows x86 - but I don't think MinGW counts as the same platform - so it is all still debatable. ;) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';