Compilation error while adding two shorts

David Zaragoza via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 24 17:07:49 PDT 2014


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 :)


More information about the Digitalmars-d-learn mailing list