val.init
monarch_dodra
monarchdodra at gmail.com
Wed Oct 2 01:16:18 PDT 2013
On Wednesday, 2 October 2013 at 02:10:35 UTC, Nick Sabalausky
wrote:
> I thought variable.init was different from T.init and gave the
> value of
> the explicit initializer if one was used. Was I mistaken?:
>
> import std.stdio;
> void main()
> {
> int a = 5;
> writeln(a.init); // Outputs 0, not 5
> }
AFAIK "variable.init" just triggers the "static call through
instance" mechanic:
The *variable* a doesn't actually have .init, so the call
resolves to "int.init".
More information about the Digitalmars-d-learn
mailing list