On 2019-05-01 14:47, Robert M. Münch wrote:
I use some C library that uses structs and many functions that use pointer to structs as arguments:

struct A {...};
myfunc(A *myA);

In C you can do this to get a lvalue:

myfunc(&(A){...});

In D this doesn't work and I get an "is not an lvalue and cannot be modified".

What's the correct D-ish way in such a case?

struct A {...};
myfunc(A *myA);

What about doing this:

auto a = A(/* set any values */);
myfunc(&a);

--
/Jacob Carlborg

Reply via email to