Table lookups - this is pretty definitive

bearophile bearophileHUGS at lycos.com
Tue Apr 1 15:41:47 PDT 2014


Artur Skawina:

> You mention AAs, so you may already realize this, but there is 
> no
> need for a mod ctor in the above example:
>
>    immutable bool[256] tab2 = {
>       bool t[256];
>       for (size_t u = 0; u < 0x100; ++u)
>           t[u] = isIdentifierChar0(cast(ubyte)u);
>       return t;
>    }();

A recent improvement in foreach loops allows to remove the cast 
from your code, but I have found a new compiler bug:

https://d.puremagic.com/issues/show_bug.cgi?id=12504

Bye,
bearophile


More information about the Digitalmars-d mailing list