As we all know, a char is 8 bit so it can store values from 0 to 255,
if I initialize a char with a greater value like 369, I get the same binary pattern than 113
i.e:01110001 under MSVC12
Is it a standard, or is it undefined behavior ?
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.
Notice that
369 - 256 == 113.4.7 Integral conversions, paragraphs 2 & 3:
But whether
charmeans the same asunsigned charorsigned charis also implementation-defined.So this behavior does depend on the compiler, although most will do it this way.