The standard gives you the following types:
signed char
unsigned char
(with char
being equivalent to one of these)
And your fixed-width int8_t
, uint8_t
on an 8-bit system are simply aliases for these.
They are all integers already.
Your statement "but the program stores the values as chars" suggests a misunderstanding of what values with these types fundamentally are. This may be due to the following.
The only "problem" you may encounter is the special-case formatting for these types in the IOStreams sublibrary:
const char c = 40;
std::cout << c << '\n';
// Output: "("
Since int8_t
is/may be signed char
, this is literally the same:
const int8_t c = 40;
std::cout << c << '\n';
// Output: "("
But this is easily "fixable" with a little integral promotion:
const char c = 40;
std::cout << +c << '\n';
// Output: 40
Now the stream gets an int
, and lexically-casts it as part of its formatting routine.
This has to do with the type system and the function overloads provided by the standard library; it has nothing to do with "how the values are stored". They are all integers.