Re: Are static variables available to other static variables?

2019-04-12 Thread XavierAP via Digitalmars-d-learn
On Friday, 12 April 2019 at 10:56:32 UTC, Jamie wrote: On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote: I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void

Re: Are static variables available to other static variables?

2019-04-12 Thread XavierAP via Digitalmars-d-learn
On Friday, 12 April 2019 at 10:56:32 UTC, Jamie wrote: On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote: I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void

Re: Are static variables available to other static variables?

2019-04-12 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 12 April 2019 at 10:56:32 UTC, Jamie wrote: On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote: I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void

Re: Are static variables available to other static variables?

2019-04-12 Thread Dennis via Digitalmars-d-learn
On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote: I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? Add `const` or `immutable` to A and it will work. I don't know

Re: Are static variables available to other static variables?

2019-04-12 Thread Jamie via Digitalmars-d-learn
On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote: I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void main() { C c = new C(); } class C {

Are static variables available to other static variables?

2019-04-12 Thread Jamie via Digitalmars-d-learn
I was trying to declare a static variable dependent on another static variable, but it didn't work. Are static variables not known to other static variables at compile time? void main() { C c = new C(); } class C { static size_t A = 2; static size_t B = 2^^A; // A is