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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 18 10:59:10 PDT 2012


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



--- Comment #12 from Don <clugdbug at yahoo.com.au> 2012-04-18 10:59:56 PDT ---
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > 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.
> 
> No, I mean the extern(C) designates linkage and calling convention, it doesn't
> affect the parameters or qualifiers for those parameters.  It also doesn't mean
> C is the language used for implementation.

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.

With one exception: if extern(C) means only "mangle as a C function" then it is
well defined for everything (because C doesn't mangle types). But I think
everybody expects it to include calling convention as well.

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.

> > 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.
> 
> Wait, how can a function marked extern(C) not use C calling convention?  Are
> these special-cased compiler functions?  

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

-- 
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