Great explanation. There is a small error in it which is worth correcting:
unsigned types promote to unsigned types, but if one is unsigned and the other signed, both are promoted to signed types.
It is the other way round. Signed will be promoted to unsigned which can be quite confusing.
Code:
int a = 7;
int b = -10;
float c = a+b;
Serial.printf("%.0f\n",c);
This will print -3 as expected.
Code:
unsigned a = 7;
int b = -10;
float c = a+b;
Serial.printf("%.0f\n",c);
This prints 4294967296 since the -10 will be interpreted as unsigned.
Another thing which sometime confuses users: For a Teensy int and long are both 32bit
Code:
Serial.printf("sizeof(int): %d\n",sizeof(int));
Serial.printf("sizeof(long): %d\n", sizeof(long));
Serial.printf("sizeof(long long): %d\n", sizeof(long long));
prints:
Code:
sizeof(int): 4
sizeof(long): 4
sizeof(long long): 8