Re: Scope of enum

2021-07-11 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 11 July 2021 at 13:21:35 UTC, DLearner wrote: Is there a 'D' way of avoiding the issue? Pass the size as a parameter to the thing instead of trying to combine things. like mixin template Thing(size_t size) { ubyte[size] pool; } and where you want it like mixin Thing!(100);

Re: Scope of enum

2021-07-11 Thread DLearner via Digitalmars-d-learn
On Sunday, 11 July 2021 at 12:47:48 UTC, Adam D Ruppe wrote: On Sunday, 11 July 2021 at 12:37:20 UTC, DLearner wrote: C:\Users\SoftDev\Documents\BDM\D\Examples\CTFE\T2>type k_mod.d // k_mod.d ubyte[MemSiz] MemPool; You didn't import the other module here. D's imports aren't like C's inclu

Re: Scope of enum

2021-07-11 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 11 July 2021 at 12:37:20 UTC, DLearner wrote: C:\Users\SoftDev\Documents\BDM\D\Examples\CTFE\T2>type k_mod.d // k_mod.d ubyte[MemSiz] MemPool; You didn't import the other module here. D's imports aren't like C's includes. Each module is independent and can only see what it itse

Re: Scope of enum

2021-07-11 Thread DLearner via Digitalmars-d-learn
On Sunday, 11 July 2021 at 12:01:27 UTC, jfondren wrote: On Sunday, 11 July 2021 at 10:58:58 UTC, DLearner wrote: Is there a way of forcing DMD to extend the scope of `MemSiz` to include `k_mod`? Best regards ``` $ cat k_mod.d import test01; ubyte[MemSiz] MemPool; $ cat test01.d enum MemSi

Re: Scope of enum

2021-07-11 Thread jfondren via Digitalmars-d-learn
On Sunday, 11 July 2021 at 10:58:58 UTC, DLearner wrote: Is there a way of forcing DMD to extend the scope of `MemSiz` to include `k_mod`? Best regards ``` $ cat k_mod.d import test01; ubyte[MemSiz] MemPool; $ cat test01.d enum MemSiz = 240; void main() { import std.stdio, k_mod; w

Scope of enum

2021-07-11 Thread DLearner via Digitalmars-d-learn
Please see the two code snippets below: ``` // test01.d enum MemSiz = 240; void main() { import k_mod; } ``` and ``` // k_mod.d ubyte[MemSiz] MemPool; ``` A number of tests need to be run on code in `k_mod`, with different sizes of the static array `MemPool` in each test. So each test