GC and void[N] in struct

vit vit at vit.vit
Mon Aug 6 18:22:24 UTC 2018


Hello,
I have this struct:

struct S{
     uint kind;
     void[N] data_;

}

Instances of struct S are allocated by standard GC new and 
S.data_ can contain pointers/ranges to GC allocated data.
If is GC disabled then  program run fine. But when is GC enabled 
then it fail randomly.

If the definition of S look like this:

struct S{
     void[N] data_;
     uint kind;
}

then program run fine with GC.enable.

Whats the problem? Something with alignment?





More information about the Digitalmars-d-learn mailing list