auto init & what the code means

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Dec 26 06:41:35 PST 2010


Well that's why I declare my variables right where I need them,
compared to e.g. Pascal where you have to define all variables at the
top.

But If I understand correctly, then you can use the following:

3) int i = int.init; // meant to be auto-initialized to int.init
4) int i; // auto-initialized to int.init, but logically not
initialized yet in the algorithm

On 12/26/10, bearophile <bearophileHUGS at lycos.com> wrote:
> Andrej Mitrovic:
>
>> int i;    // auto-initialized to int.init
>> int i = void; // not initialized
>
> I think the OP meant:
>
> 1) int i = void; // not initialized
> 2) int i = 0; // initialized to 0
> 3) int i; // meant to be auto-initialized to int.init, similar to case 2
> 4) int i; // auto-initialized to int.init, but logically not initialized yet
> in the algorithm
>
> So he was thinking about ways to tell apart case 3 from case 4 (C# doesn't
> have this problem).
>
> Bye,
> bearophile
>


More information about the Digitalmars-d mailing list