<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">And in fact, that is what it does :)<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">void main()</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    import std.stdio;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    auto x = typeid(int);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    writefln("%s, %s", x.init.length, x.init.ptr);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">}</div><div class=""><br class=""></div><div class="">output:</div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">0, null</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class=""><div style="font-family: Helvetica; font-size: 12px;" class="">Doing some research, I found this tidbit in history:</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div class=""><a href="https://issues.dlang.org/show_bug.cgi?id=2990" class="">https://issues.dlang.org/show_bug.cgi?id=2990</a></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">The only basic types that have init() defined are the ones that have non-zero initializers. I suppose we have 3 options:</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">1. Revise the documentation so it says “if this returns null with zero length, it means the type is initialized with all zeros, and use tsize to get the size of the type”</div><div style="font-family: Helvetica; font-size: 12px;" class="">2. Add the appropriate overrides to all the druntime types.</div><div style="font-family: Helvetica; font-size: 12px;" class="">3. We could make TypeInfo.init return (cast(void *)null)[0..tsize] by default, defaulting all inits to a sane value.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">My personal preference is for 3, since it adds no new functions, and will fix any omissions that we haven’t discovered or that would be added in the future.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">Clearly, though, this identifies how unused that function really is :)</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">I recall now, the compiler only sets up static data inside the typeinfo for things like classes and structs, and the TypeInfo_Struct init() function reads that when determining what to return.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">Everything else is defined in druntime.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">-Steve</div><div style="font-family: Menlo; font-size: 11px;" class=""><br class=""></div></div><div><blockquote type="cite" class=""><div class="">On Jun 11, 2015, at 7:48 PM, Mike Franklin <<a href="mailto:slavo5150@yahoo.com" class="">slavo5150@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="">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" class="">[1] <a id="yui_3_16_0_1_1434066147164_5235" href="https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L289" class="">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" class=""></div><div dir="ltr" id="yui_3_16_0_1_1434066147164_5235" class="">[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" class="">https://github.com/D-Programming-Language/druntime/blob/master/src/rt/typeinfo/ti_int.d#L18</a><br class=""></div><div style="" class="" id="yui_3_16_0_1_1434066147164_5235"> </div><div class=""></div><div id="yui_3_16_0_1_1434066147164_5228" class=""><span class="">Mike</span></div>  <br class=""></div></div></div></blockquote></div><br class=""></body></html>