I have three short variables. When I add two together and assign the result to the third, eclipse tells me that I need to cast it to a short !
short sFirst, sSecond, sThird;
sFirst = 10;
sSecond = 20;
sThird = sFirst + sSecond;
Hovever, when I do a simple assignment followed by an incremental assignment, all is fine.
short sFirst, sSecond, sThird;
sFirst = 10;
sSecond = 20;
sThird = sFirst;
sThird += sSecond;
Why is this ?