Re: Compilation error while adding two shorts

2014-06-24 Thread David Zaragoza via Digitalmars-d-learn
Interesting info, I've never seen this behavior in C since the conversion is implicit as [2] notes. A simple cast resolves the problem in D: module main; int main(string[] argv){ short asd = 1; short qwe = cast(short)(asd + asd); return 0; } Thanks for your answer :)

Re: Compilation error while adding two shorts

2014-06-23 Thread Ali Çehreli via Digitalmars-d-learn
On 06/23/2014 10:03 PM, David Zaragoza wrote:> 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):