Would like to see ref and out required for function calls

Jacob Carlborg doob at me.com
Thu Sep 13 23:28:22 PDT 2012


On 2012-09-13 18:28, Sean Kelly wrote:

> I love the idea.  However, this could complicate working with C APIs, particularly regarding structs which are often passed by reference as a matter of course.  For example:
>
> struct some_c_struct {}
>
> void fn(ref some_c_struct s) {
>      some_c_func(&s);
> }
>
> I guess the only way to know if this will turn out to be a real issue is to give it a try though.

This applies to static arrays as well:

extern (C) void foo (ref int[3] a);

Since in D static arrays have value semantics.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list