'short'.
> The documentation seems a bit misleading:
> it says here:
[quoted text clipped - 9 lines]
> Add the value of the second operand to the value of the first operand;
> store the result in the object specified by the first operand.
Hi,
http://msdn2.microsoft.com/en-us/library/k630sk6z.aspx
bullet point 1 applies.
See here for the rules:
http://msdn2.microsoft.com/en-us/library/3t4w2bkb.aspx
The behavior of += is not explicitly specified, but the you can see that the
documentation allows for it. It is allowed by the C/C++ standards as well.
I still think it is idiotic that += does this, since it is supposed to be
equal to = +.

Signature
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
A Wieser - 29 Dec 2006 07:26 GMT
|> The documentation seems a bit misleading:
| > it says here:
ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vclang/html/a6135e34-4fce-4c79-87b6-b6447db3507e.htm
| > "The assignment operators return the value of the object specified by the
| > left operand after the assignment. The resultant type is the type of the
| > left operand. "
| >
| > Also, the documentation here:
ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vclang/html/b028cf35-2ff1-4f14-9027-fd53ebec8aa0.htm
| > says:
| > "+=
[quoted text clipped - 14 lines]
| I still think it is idiotic that += does this, since it is supposed to be
| equal to = +.
OK, I see here that it says:
If none of the above conditions are met, both operands are converted to type
int.
So that means the compiler really should be warning me in the second case
too, where I write
short a=1;
short b=2;
a = a + b;
That's even more depressing! So in the next version of the compiler, I'll
get even more warnings.
Maybe the next version will have C4416 defined.
// warning C4416: Ha Ha Ha! You're still using 16 bit values!
--
Anthony Wieser
Wieser Software Ltd