从我从得到的回答这个问题,看来C++继承了这一要求,对于转换short成int从C.执行算术运算时,我可以挑你的大脑,以为什么这是用C首先介绍?为什么不做这些操作short呢?
short
int
例如(取自评论中的dyp建议):
short s = 1, t = 2 ; auto x = s + t ;
x将具有int类型.
x
c c++ int short integer-promotion
c ×1
c++ ×1
int ×1
integer-promotion ×1
short ×1