[Issue 7854] Non-C attributes allowed on extern(C) function parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 17 02:03:02 PDT 2012


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



--- Comment #10 from Don <clugdbug at yahoo.com.au> 2012-04-17 02:03:47 PDT ---
(In reply to comment #9)
> (In reply to comment #6)
> > > I'm not exactly talking about binding or calling convention, I'm more talking
> > > about types.  To me, the two are orthogonal.
> > 
> > Whereas I would argue that since you're declaring a C function, it should be a
> > _C_ function and therefore not include features which C doesn't have. The only
> > reason that I think that permitting pure and nothrow on C functions makes any
> > sense is out of pure necessity.
> 
> No.  An extern(C) function does not mean it's a C function.  It just means it
> has C linkage.  See here: http://dlang.org/attribute.html#linkage
> 
> extern(C) has nothing to do with parameters, only calling conventions.

I don't understand that statement. Do you mean 'parameters, only name mangling"
? If so, that that isn't true.
On 32-bit x86 Windows,

extern(D) void foo(int x)

passes x in the EAX register.

extern(C) void foo(int x)

passes x on the stack.
It's not just a name mangling issue.

The confusion comes because there are some druntime functions which use C name
mangling but the extern(D) calling convention! This is not true of all
extern(C) functions.

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


More information about the Digitalmars-d-bugs mailing list