A little D2 quiz, of course. This was discussed some time ago, but repeating 
now and then such things doesn't hurt in D.learn.

Do you think this little program compiles? Or do you think the D2 compiler will 
refuse to compile it and ask you for a cast from int -> ubyte?

If this compiles (maybe because you have added a cast at line 4) do you think 
this program is working correctly?


void main() {
    ubyte[256] table;
    foreach (ubyte i, ref x; table)
        x = 255 - i;
}

Bye,
bearophile

Reply via email to