http://d.puremagic.com/issues/show_bug.cgi?id=7854



--- Comment #13 from Steven Schveighoffer <schvei...@yahoo.com> 2012-04-18 
11:23:14 PDT ---
(In reply to comment #12)
> 
> But C doesn't HAVE a calling convention for non-C types!
> 
> extern(C) void foo( void delegate() dg)
> DOES NOT MAKE SENSE. It's not C, it's something else.

I would expect that in this case, whatever rules are established for passing
custom types of size dg.sizeof would apply.  I would never have guessed that
calling convention concerned itself with types or how to pass specific types. 
I thought it had to do only with where the arguments are placed, what order
they are passed, etc.

But does C even *have* a defined calling convention?  I mean even on the same
platform (Microsoft CRT) you can use any of 6 calling conventions
http://msdn.microsoft.com/en-us/library/984x0h58%28v=vs.80%29.aspx

I also note that none of those specify anything about how types affect the
calls.

> There are really two options:
> (1) disallow non-C parameters in extern(C) functions
> (2) extend the definition of extern(C) to specify what happens with non-C
> parameters.

I think option 1 is too damaging to current code.  Option 2 is fine, as long as
it doesn't get into describing the actual calling convention (which is platform
specific).  e.g. say ref parameters are passed as if the address of the
parameter was passed.

> Yes. In those special cases, extern(C) just means C name mangling.
> I think that's an indicator of how vague the spec is.

That sounds unreasonably confusing.  What benefit do we have for specially
treating those functions?  I'd rather see a pragma(nomangle), or have the
functions actually use C calling convention.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to