If I understand well, int_fast_n_t
types are guaranteed to be at least n
bits long. Depending on the compiler and the architecture of the computer these types can also be defined on more than n
bits. For instance, a int_fast_8_t
could be interpreted as a 32 bits int
.
Is there some kind of mechanism which enforces that the value of an int_fast_n_t
never overflow even if the true type is defined on more than n
bits?
Consider the following code for example:
int main(){
int_fast8_t a = 64;
a *= 2; // -128
return 0;
}
I do not want a
to be greater than 127
. If a
is interpreted as a "regular" int
(32 bits), is it possible that a
exceed 127
and be not equal to -128
?
Thanks for your answers.