What's best practice to use compound literals with structs and C-APIs?
Robert M. Münch
robert.muench at saphirion.com
Wed May 1 12:47:22 UTC 2019
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?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
More information about the Digitalmars-d-learn
mailing list