What happens when evaluating
int x = -2147483648
?
When evaluating
-2147483648
,2147483648
is a integer constant which has long type not int, so the result -2147483648 of evaluating-2147483648
is of type long, not int.When evaluating the assignment "int x = ...", the RHS is value -2147483648 of long type, which is in the range of
x
's typeint
. Will value -2147483648 be implicitly converted from long to int, and the conversion keep the value -2147483648 unchanged?
Thanks.
See Question&Answers more detail:os