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
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
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
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
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;
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
Is there a simple way to to do this?
enum A{
a1,
a2
}
void fun(A a){...}
void test(){
fun(A.a1); //works
fun(a1); //I'd like a1 to work, but just where an A is expected to avoid
polluting namespace.
}
On 6/08/2014 6:11 p.m., Timothee Cour via Digitalmars-d-learn wrote:
Is there a simple way to to do this?
enum A{
a1,
a2
}
void fun(A a){...}
void test(){
fun(A.a1); //works
fun(a1); //I'd like a1 to work, but just where an A is expected to
avoid polluting namespace.
}
The magic of with
On Wednesday, 6 August 2014 at 07:23:32 UTC, Rikki Cattermole
wrote:
The magic of with statements!
enum A {
a1,
a2
}
void func(A a){}
void main(){
func(A.a1);
with(A) {
func(a1);
}
}
And if you want to be *really* concise:
with (A)
Thanks, I know with statement could be used but I was hoping for a solution
not involving adding syntax to call site.
void fun(with(A){A a}, int b){...} //conceptually like this
void test(){
int a1=1;
fun(A.a1, a1); // would work
fun(a1, a1);// would work
}
On Wed, Aug 6, 2014 at 8:22
On Wednesday, 6 August 2014 at 16:48:57 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Thanks, I know with statement could be used but I was hoping
for a solution
not involving adding syntax to call site.
If you control the declaration of the enum, you could write:
alias a1 = A.a1;
alias
On Wed, Aug 6, 2014 at 12:04 PM, via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On Wednesday, 6 August 2014 at 16:48:57 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Thanks, I know with statement could be used but I was hoping for a
solution
not involving adding
12 matches
Mail list logo