Scope of enum

DLearner bmqazwsx123 at gmail.com
Sun Jul 11 10:58:58 UTC 2021


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 has the enum `MemSiz`, but set to different values.

However, DMD does not recognise the enum `MemSiz` within `k_mod`,
  failing with 'undefined identifier'.

Is there a way of forcing DMD to extend the scope of `MemSiz` to 
include `k_mod`?

Best regards





More information about the Digitalmars-d-learn mailing list