rdmd vs dmd WRT static constructors

Andrew Edwards via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 8 19:57:54 PDT 2017


RDMD does not behave the same as DMD WRT static constructors. The 
following example, extracted form Mike Parker's "Learning D", 
does not produce the same result:

// stat1.d
module stat1;
import std.stdio;
static this() { writeln("stat1 constructor"); }

// stat2.d
module stat2;
import std.stdio;
static this() { writeln("stat2 constructor"); }

// statmain.d
void main() { }

$ rdmd statmain.d stat1.d stat2.d
// outputs nothing...

$ dmd statmain.d stat1 stat2
$ ./statmain
// outputs...
stat1 constructor
stat2 constructor

Bug or intended behaviour?

Thanks,
Andrew


More information about the Digitalmars-d-learn mailing list