casting int[] to bool[]

Bill Baxter wbaxter at gmail.com
Wed Jan 28 18:57:31 PST 2009


On Thu, Jan 29, 2009 at 11:57 AM, Saaa <empty at needmail.com> wrote:
> Erm, anybody is fine to me..
>
> Is it the naming, still the casting or something else totally?

>  dataIn[i][index] = cast(bool) t;

It's just that casting is a very blunt tool and should be avoided
whenever possible, because the compiler won't tell you if you're doing
something completely crazy.

Here you could use somethign like:

    dataIn[i][index] = (t!=0);

instead of casting.

--bb


More information about the Digitalmars-d-learn mailing list