For this code:
int main(int argc, char **argv)
{
auto a = static_cast<uint8_t>(sizeof(uint64_t));
auto b = 8 * static_cast<uint8_t>(sizeof(uint64_t));
auto c = static_cast<uint32_t>(sizeof(uint64_t));
auto d = 8 * static_cast<uint32_t>(sizeof(uint64_t));
return EXIT_SUCCESS;
}
- The type of
aresolves tounsigned char, - The type of
bresolves toint, - The type of
cresolves tounsigned intand, - The type of
dresolves tounsigned int
I expect these results for a, c, and d, but I'm baffled by b.
64 clearly fits in a 8-bit unsigned char. Can anyone explain, please?
