On Tue, 29 Apr 2014 03:43:54 -0400, Andrey <n...@none.no> wrote:
btw,
short a,b,c;
a = b + c; //error: cannot implicitly convert expression of type 'int'
to 'short'
Guys!! Tell me that I have an old slutty version of the compiler...
No. It's due to integer promotion. All operations are done at the int
level, so the expression b + c is actually an int. C allows this
transgression because it's convenient. D makes you acknowledge that you
are throwing away bits the compiler generated for you.
Note, += does work:
a = b;
a += c;
-Steve