Re: static array of structs clarification questions

2016-02-13 Thread Marc Schütz via Digitalmars-d-learn
On Friday, 12 February 2016 at 21:56:09 UTC, Steven Schveighoffer wrote: That's odd. I think anonymous probably has the answer (they are context pointers), but I'm also surprised they are null, they shouldn't be. In this example, `void foo()` doesn't access any outer variables, so there's no

Re: static array of structs clarification questions

2016-02-13 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 13 February 2016 at 10:22:36 UTC, Marc Schütz wrote: On Friday, 12 February 2016 at 21:56:09 UTC, Steven Schveighoffer wrote: That's odd. I think anonymous probably has the answer (they are context pointers), but I'm also surprised they are null, they shouldn't be. In this

Re: static array of structs clarification questions

2016-02-13 Thread Marc Schütz via Digitalmars-d-learn
On Saturday, 13 February 2016 at 14:53:39 UTC, ZombineDev wrote: On Saturday, 13 February 2016 at 10:22:36 UTC, Marc Schütz wrote: On Friday, 12 February 2016 at 21:56:09 UTC, Steven Schveighoffer wrote: That's odd. I think anonymous probably has the answer (they are context pointers), but I'm

static array of structs clarification questions

2016-02-12 Thread WhatMeWorry via Digitalmars-d-learn
I was thinking about fixed length arrays of structures the other day so I played around with the flowing code: struct Foo { inti; string str; void info() { writeln("i = ", i, "str = ", str); } } Foo[2] foos; auto f1 = Foo(1, "6chars"); // this

Re: static array of structs clarification questions

2016-02-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/12/16 4:08 PM, WhatMeWorry wrote: I was thinking about fixed length arrays of structures the other day so I played around with the flowing code: struct Foo { inti; string str; void info() { writeln("i = ", i, "str = ", str); } } Foo[2]

Re: static array of structs clarification questions

2016-02-12 Thread anonymous via Digitalmars-d-learn
On 12.02.2016 22:08, WhatMeWorry wrote: question #1: The static array must contain the fat pointers to str variables. But where is the string data itself actually held: the stack? the heap? somewhere else? (does it vary depending on location or scope) Depends on how the string was created. You