Top "Integer-promotion" questions

Anything related to C and C++ integer promotions, i.e. a class of data-type conversions that happens automatically when an object of integer type appears in certain contexts (e.g. when a value of type `short` is added to an `int` it is automatically promoted to `int` type before performing the operation).

Does one double promote every int in the equation to double?

Does the presence of one floating-point data type (e.g. double) ensure that all +, -, *, /, %, etc math operations assume double …

c++ floating-point type-conversion integer-promotion
Type conversion - unsigned to signed int/char

I tried the to execute the below program: #include <stdio.h> int main() { signed char a = -5; unsigned …

c types type-conversion integer-promotion signedness
In a C expression where unsigned int and signed int are present, which type will be promoted to what type?

I have a query about data type promotion rules in C language standard. The C99 says that: C integer promotions …

c integer-promotion
Addition of two chars produces int

I've made a simple program and compiled it with GCC 4.4/4.5 as follows: int main () { char u = 10; char x = 'x'; char …

c++ integer integer-overflow integer-promotion
Why must a short be converted to an int before arithmetic operations in C and C++?

From the answers I got from this question, it appears that C++ inherited this requirement for conversion of short into …

c++ c int short integer-promotion
How do promotion rules work when the signedness on either side of a binary operator differ?

Consider the following programs: // http://ideone.com/4I0dT #include <limits> #include <iostream> int main() { int …

c++ overflow arithmetic-expressions integer-promotion
type promotion in C

I am quite confused by the following code: #include <stdio.h> #include <stdint.h> int main(…

c types integer-promotion