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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 18 05:20:47 PDT 2012


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



--- Comment #11 from Steven Schveighoffer <schveiguy at yahoo.com> 2012-04-18 05:21:34 PDT ---
(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.

In other words, if the language implementing the function
implements/understands immutable, then why should it be disallowed to pass
immutable to an extern(C) function?  Same goes for ref, scope, in, out.

If something is passed in a register vs on the stack, that's part of the
calling convention, no?  It doesn't actually affect the parameter type or its
properties.  That's what I meant for 'nothing to do with parameters'.  Maybe
that was a misleading statement...

> 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?  If that's the case, I don't see how
those exceptions should affect the rules of extern(C), it doesn't affect
anything outside the compiler/runtime.

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