<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px">Ok, but if you look at the TypeInfo class in object.d [1], you'll see init() returns 
null.  Then if you look at the TypeInfo_i class for integers [2], it doesn't
 override init().  I, therefore, suspect some compiler special treatment.  So, how (and where in the source code) does an integer
 get it's 32-bit 0 initial value?<br style="" class=""><br style="" class=""><div id="yui_3_16_0_1_1434066147164_5239" dir="ltr">[1] <a id="yui_3_16_0_1_1434066147164_5235" href="https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L289">https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L289</a></div><div id="yui_3_16_0_1_1434066147164_5272" dir="ltr"></div><div dir="ltr" id="yui_3_16_0_1_1434066147164_5235">[2] <a id="yui_3_16_0_1_1434066147164_5320" href="https://github.com/D-Programming-Language/druntime/blob/master/src/rt/typeinfo/ti_int.d#L18">https://github.com/D-Programming-Language/druntime/blob/master/src/rt/typeinfo/ti_int.d#L18</a><br></div><div style="" class="" id="yui_3_16_0_1_1434066147164_5235"> </div><div></div><div id="yui_3_16_0_1_1434066147164_5228"><span>Mike</span></div>  <br><div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"> <font face="Arial" size="2"> On Friday, June 12, 2015 3:58 AM, Steven Schveighoffer via dmd-internals <dmd-internals@puremagic.com> wrote:<br> </font> </div>  <br><br> <div class="y_msg_container"><div id="yiv3021405602"><div>I don’t know that the compiler cares what’s in the TypeInfo, it uses it’s own internal representation I think. This is a communication to druntime of how to initialize the type. The idea is not to take up data in the static section with zero bytes.<div class="yiv3021405602"><br class="yiv3021405602" clear="none"></div><div class="yiv3021405602">You will see it used in the runtime, for example: <a rel="nofollow" shape="rect" class="yiv3021405602" target="_blank" href="https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L2592">https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L2592</a></div><div class="yiv3021405602"><br class="yiv3021405602" clear="none"></div><div class="yiv3021405602">It’s probably used elsewhere too, but I’m not sure where to look.</div><div class="yiv3021405602"><br class="yiv3021405602" clear="none"></div><div class="yiv3021405602">-Steve</div><div class="yiv3021405602yqt9151816038" id="yiv3021405602yqt06281"><div class="yiv3021405602"><br class="yiv3021405602" clear="none"><div class="yiv3021405602"><div><blockquote class="yiv3021405602" type="cite"><div class="yiv3021405602">On Jun 11, 2015, at 8:02 AM, Mike Franklin via dmd-internals <<a rel="nofollow" shape="rect" class="yiv3021405602" ymailto="mailto:dmd-internals@puremagic.com" target="_blank" href="mailto:dmd-internals@puremagic.com">dmd-internals@puremagic.com</a>> wrote:</div><br class="yiv3021405602Apple-interchange-newline" clear="none"><div class="yiv3021405602">There is a comment [1] in object.d for TypeInfo.init reading:<br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none">"Return default initializer.  If the type should be initialized to all zeros, an array with a null ptr and a length equal to the type size will be returned."<br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none">Also, I see where the null pointer is set in typinf.c [2].  <br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none">Using int as an example, how does the compiler go from a null pointer and a size to a 32-bit 0?  Where is that done in the compiler?<br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none">[1] <a rel="nofollow" shape="rect" class="yiv3021405602" target="_blank" href="https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L286-L287">https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L286-L287</a><br class="yiv3021405602" clear="none">[2] <a rel="nofollow" shape="rect" class="yiv3021405602" target="_blank" href="https://github.com/D-Programming-Language/dmd/blob/master/src/typinf.c#L460">https://github.com/D-Programming-Language/dmd/blob/master/src/typinf.c#L460</a><br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none"><br class="yiv3021405602" clear="none">Thanks for the help,<br class="yiv3021405602" clear="none">Mike<br class="yiv3021405602" clear="none">_______________________________________________<br class="yiv3021405602" clear="none">dmd-internals mailing list<br class="yiv3021405602" clear="none"><a rel="nofollow" shape="rect" class="yiv3021405602" ymailto="mailto:dmd-internals@puremagic.com" target="_blank" href="mailto:dmd-internals@puremagic.com">dmd-internals@puremagic.com</a><br class="yiv3021405602" clear="none">http://lists.puremagic.com/mailman/listinfo/dmd-internals</div></blockquote></div><br class="yiv3021405602" clear="none"></div></div></div></div></div><br><div class="yqt9151816038" id="yqt57412">_______________________________________________<br clear="none">dmd-internals mailing list<br clear="none"><a shape="rect" ymailto="mailto:dmd-internals@puremagic.com" href="mailto:dmd-internals@puremagic.com">dmd-internals@puremagic.com</a><br clear="none"><a shape="rect" href="http://lists.puremagic.com/mailman/listinfo/dmd-internals" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a></div><br><br></div>  </div> </div>  </div></div></body></html>