Creating an array of C structs

2014-01-27 Thread Colin Grogan
Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruct{ int x; float y; } } It fails with the (unhelpful imo) error message: source/app.d(7): Error: a

Re: Creating an array of C structs

2014-01-27 Thread Namespace
On Monday, 27 January 2014 at 09:06:17 UTC, Colin Grogan wrote: Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruct{ int x; float y; } } It fails

Re: Creating an array of C structs

2014-01-27 Thread Colin Grogan
On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: On Monday, 27 January 2014 at 09:06:17 UTC, Colin Grogan wrote: Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct

Re: Creating an array of C structs

2014-01-27 Thread Stanislav Blinov
On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment? :) No! Evenryone will see this! :E~

Re: Creating an array of C structs

2014-01-27 Thread Francesco Cattoglio
On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment? :) HA-HA! (read it with Nelson voice, ofc)

Re: Creating an array of C structs

2014-01-27 Thread Francesco Cattoglio
On Monday, 27 January 2014 at 13:08:28 UTC, Colin Grogan wrote: In my defense, I believe C initializes arrays with the curly brackets Can I keep making excuses? Yes you can... And don't worry, I mess up initialization too. Lots of time. Especially when I tried initializing an array of