Compilation error while adding two shorts
David Zaragoza via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jun 23 22:03:06 PDT 2014
Hello
I'm trying to compile the following program:
module main;
int main(string[] argv){
short asd = 1;
short qwe = asd + asd;
return 0;
}
And the compiler gives this error:
C:\David>dmd simple
simple.d(5): Error: cannot implicitly convert expression
(cast(int)asd + cast(in
t)asd) of type int to short
Why is there a cast if I'm adding to shorts?
Regards
More information about the Digitalmars-d-learn
mailing list