I have a query about data type promotion rules in C language standard.
The C99 says that:
C integer promotions also require that "if an int can represent all values of the original type, the value is converted to an int; otherwise, it is converted to an unsigned int."
My questions is in case of a C language expression where unsigned int
and signed int
are present, which type will be promoted to what type?
E.g. int
cannot represent all the values of the unsigned int
(values larger than MAX_INT
values) whereas unsigned int
cannot represent the -ve values, so what type is promoted to what in such cases?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…