size of executables

Sivo Schilling sivo.schilling at web.de
Mon Aug 11 04:48:57 PDT 2008


Replay to Christian,

ok I get it. Structs are treated as POD by the compiler and therefore
have a default initializer which have to be present in the executable. 

Thanks.

Christian Kamm Wrote:

> Sivo Schilling Wrote:
> >     struct MDSA
> >     {
> >         float[SD][SD][SD] m2;
> >         int[SD][SD][SD]   wt;
> >         int[SD][SD][SD]   mr;
> >         int[SD][SD][SD]   mg;
> >         int[SD][SD][SD]   mb;
> >     }
> > 
> >     MDSA mdsa;
> 
> vs
> 
> >     float[SD][SD][SD] m2;
> >     int[SD][SD][SD]   wt;
> >     int[SD][SD][SD]   mr;
> >     int[SD][SD][SD]   mg;
> >     int[SD][SD][SD]   mb;
> 
> In the first case DMD will generate a default initializer for the struct which is probably what you're looking at in the DATA section. I do not think you can stop DMD from doing that - it's part of the TypeInfo instance it generates for the struct.
> 
> Christian Kamm
> 



More information about the Digitalmars-d-learn mailing list