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



--- Comment #9 from Steven Schveighoffer <schvei...@yahoo.com> 2012-04-16 
05:43:17 PDT ---
(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.

What would you expect here?

extern(C) void foo(long);

to accept 32-bit or 64-bit integer?  The answer is, 64 bit.  The confusion that
would abound if you had to use C's types and keywords whenever declaring an
extern(C) function would be not worth the trouble.

The one exception, as Don pointed out, is variadic arguments, but that is
covered here: http://dlang.org/function.html#variadic

> > extern(C) int pipe(ref int[2] fds);
> 
> I would expect this to simply be
> 
> extern(C) int pipe(int* fds);
> 
> because what C does is pass a pointer, not a fixed-size array.

This does not say anything about the size.  Even though it's a 'hint' in C,
it's enforceable in D.

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

Reply via email to