Implicit conversion error
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Apr 30 15:24:14 PDT 2015
Paul:
> When compiled on a 64 bit machine, this line
>
> int r = uniform(0, mobs.length);
".length" returns a size_t, and 0 is an int. uniform() probably
decides to unify those types to a size_t. A size_t is 32 bit on
32 bit machines and 64 bits on 64 bit machines. But D "int" is
always a 32 bit signed integer. D allows implicit assignment of a
32 bit size_t to int but not a 64 bit size_t to an int. I agree
that it's a bit of a mess.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list