I was reading the C++ FAQ and it says
The C++ language guarantees a byte must always have at least 8 bits
So what does that mean for the <cstdint> types?
Side question – if I want an array of bytes should I use int8_t or char and why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
C++ (and C as well) defines
intX_t(i.e. the exact width integer types) typedefs as optional. So, it just won’t be there if there is no addressable unit that’s exactly 8-bit wide.If you want an array of bytes, you should use
char, assizeof char(andsigned charandunsigned char) is well-defined to always be 1 byte.