[dmd-beta] rvalue references

Steve Schveighoffer schveiguy at yahoo.com
Thu Apr 12 14:38:56 PDT 2012


I still want to say, extern(C) does not mean C function.  It means C linkage/calling convention.  The function can easily be implemented in D (druntime is full of this).

-Steve




>________________________________
> From: Michel Fortin <michel.fortin at michelf.com>
>To: Discuss the dmd beta releases for D <dmd-beta at puremagic.com> 
>Sent: Thursday, April 12, 2012 5:34 PM
>Subject: Re: [dmd-beta] rvalue references
> 
>Le 2012-04-12 à 17:24, Andrej Mitrovic a écrit :
>
>> Currently you don't have to use address-of operator if you mark the
>> extern(C) function as taking ref:
>> 
>> extern(C) void c_modify_int(ref int x) { }
>> void modify_int(ref int x)
>> {
>>    c_modify_int(x);
>> }
>
>Even if declaring C functions with ref is allowed, it can sometime be a problem to declare C functions like that. Not only it changes the usage, but also it's not too rare to see pointer parameters like this accepting a null pointer as a way to make the parameter optional, which ref won't let you do.
>
>-- 
>Michel Fortin
>michel.fortin at michelf.com
>http://michelf.com/
>
>
>
>_______________________________________________
>dmd-beta mailing list
>dmd-beta at puremagic.com
>http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120412/1e645720/attachment.html>


More information about the dmd-beta mailing list