A tiny piece of code drives me crazy but hopefully you can prevent me from jumping out of the window. Look here:
#include <iostream>
#include <cstdint>
int main()
{
int8_t i = 65;
int8_t j;
std::cout << "i = " << i << std::endl; // the 'A' is ok, same as uchar
std::cout << "Now type in a value for j (use 65 again): " << std::endl;
std::cin >> j;
std::cout << "j = " << j << std::endl;
if (i != j)
std::cout << "What is going on here?????" << std::endl;
else
std::cout << "Everything ok." << std::endl;
return 0;
}
If I use int
instead of int8_t
everything ok. I need this as 8-bit unsigned integers
, not bigger. And btw. with unsigned char
it's the same behaviour - of course - as with int8_t
.
Anyone with a hint?
int8_t
can be any 8-bit signed integer type.char
is perfectly valid. – Heinrike