B
bruno.van.dooren
According to various documentation I've read, the unary plus returns
the value of its operand after integral promotion.
Now consider the following example:
short a = 1;
short b = 2;
b = +a;
Shouldn't the assignment of +a to b generate a compiler warning that
an int is assigned to a short? Because if I understood correctly, the
result of +a should be int.
I know that
b += a;
will generate a warning because of integral promotion.
the value of its operand after integral promotion.
Now consider the following example:
short a = 1;
short b = 2;
b = +a;
Shouldn't the assignment of +a to b generate a compiler warning that
an int is assigned to a short? Because if I understood correctly, the
result of +a should be int.
I know that
b += a;
will generate a warning because of integral promotion.