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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 12 12:55:50 PDT 2012


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
          Component|websites                    |DMD


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2012-04-12 12:56:33 PDT ---
(In reply to comment #2)
> extern(C) does not have any effect on parameters. 

Not so. It most definitely does! Doesn't make much difference on Linux, but on
Windows they are quite different. Also variadic functions are defined in the
spec to be different for extern(C) vs extern(D), on all platforms.


> Note that you can easily
> implement extern(C) functions in D (in fact the runtime heavily relies on
> this).

I know, and it worries me. The question is, is that just
implementation-specific behaviour?

> Also note that because C treats fixed-sized array parameters as pointers, and D
> treats them as values, the following idiom has emerged, which would not be
> possible if ref wasn't allowed:
> 
> extern(C) int pipe(ref int[2] fds);

Yeah, and that's nice. But the odd thing is, that is actually implementable in
C. Whereas other things, such as lazy, might not be. The key issue is, should
extern(C) allow signatures that *cannot* be implemented in C?

> Changing to websites, since this is really a spec issue.  The compiler is
> implemented properly IMO.

I agree it is probably a spec issue. Spec issues are normally treated with DMD
+ spec keyword. It is part of the DMD download.

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