Implicit conversion error
Paul via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Apr 30 10:46:10 PDT 2015
When compiled on a 64 bit machine, this line
int r = uniform(0, mobs.length);
gives me an error:
Error: cannot implicitly convert expression (uniform(0,
mobs.length)) of type ulong to int
but it compiles ok on a 32 bit machine.
I thought it was the expression on the righthand side returning a
ulong which won't 'fit' in an int but if I substitute a numerical
value instead of trying to get the length, eg uniform(0, 5) it
compiles.
Why is that?
(mobs is an array of structs)
TIA
Paul
More information about the Digitalmars-d-learn
mailing list