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
a
resolves tounsigned char
, - The type of
b
resolves toint
, - The type of
c
resolves tounsigned int
and, - The type of
d
resolves 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?