Is there a way to see if .init has been set by the user?
simendsjo
simendsjo at gmail.com
Sat Sep 21 09:09:34 PDT 2013
On Saturday, 21 September 2013 at 15:43:11 UTC, Maxim Fomin wrote:
> On Saturday, 21 September 2013 at 11:13:57 UTC, simendsjo wrote:
>> I want to know if a variable has changed .init, but I don't
>> know if it's possible if the .init value is the same. Does
>> anyone have a solution for this?
>>
>> int a;
>> int b = 0;
>> pragma(msg, a.init); // 0
>> pragma(msg, b.init); // 0
>> // how can I see that b has "= 0"?
>
> Strictly speaking this is an ill-posed question. Are talking
> about testing at runtime whether some variable was changed from
> init to some non-default value?
No, at compile-time. It's trivial to see if init is changed, but
I want to see if it's set even if it's to T.init.
More information about the Digitalmars-d-learn
mailing list