Offset of globals in linking time.

JDavidls jdavidls at gmail.com
Mon Feb 4 12:16:53 PST 2013


Hi

I need to initialize a global variable with a pointer to another 
global variable but dmd compler raises an error:

uint a = 5;
uint* p = &a; // error: non-constant expression & a
const uint* cp = &a; // error: non-constant expression & a

All C compilers support this assignation ¿whi dlang cannot?

I think this is a great limitation for writing huge dependent of 
initial-state defined program as a virtual machine (in this case).

---

Just try it with ldc, appears to work. I'm also compiling gdc for 
test with it.


Thanks,


More information about the Digitalmars-d mailing list