reinterpret_cast between char* and std::uint8_t* – safe?

Ok, let’s get truly pedantic. After reading this, this and this, I’m pretty confident that I understand the intention behind both Standards. So, doing reinterpret_cast from std::uint8_t* to char* and then dereferencing the resulting pointer is safe and portable and is explicitly permitted by [basic.lval]. However, doing reinterpret_cast from char* to std::uint8_t* and then dereferencing … Read more

uint8_t can’t be printed with cout

It doesn’t really print a blank, but most probably the ASCII character with value 5, which is non-printable (or invisible). There’s a number of invisible ASCII character codes, most of them below value 32, which is the blank actually. You have to convert aa to unsigned int to output the numeric value, since ostream& operator<<(ostream&, … Read more