Re: How to get the address of a static struct?

2017-07-09 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 10 July 2017 at 03:48:17 UTC, FoxyBrown wrote: static struct S auto s = &S; // ?!?!?! invalid because S is a struct, but... basically s = S. So S.x = s.x and s.a = S.a; Why do I have to do this? Static has a different meaning for struct. More or less it means it won't have acces

Re: How to get the address of a static struct?

2017-07-09 Thread rikki cattermole via Digitalmars-d-learn
Thread local struct: ```D module foobar; struct Foo { int x; } Foo foo = Foo(8); void main() { import std.stdio; writeln(&foo); } ``` Global struct: ```D module foobar; struct Foo { int x; } __gshared Foo foo = Foo(8); void main() { import std.stdio

How to get the address of a static struct?

2017-07-09 Thread FoxyBrown via Digitalmars-d-learn
static struct S { public static: int x; string a; } auto s = &S; // ?!?!?! invalid because S is a struct, but... basically s = S. So S.x = s.x and s.a = S.a; Why do I have to do this? Because in visual D, global structs don't show up in the debugger. So if I crea