次のコードを見てください。
#include <stdio.h>
int main(void)
{
int a;
a = 2147483647;
printf("a + 1 = %d \t sizeof (a + 1) = %lu\n", a + 1, sizeof (a + 1));
printf("a + 1L = %ld \t sizeof (a + 1L) = %lu\n", a + 1L, sizeof (a + 1L));
a = -1;
printf("a + 1 = %d \t sizeof (a + 1) = %lu\n", a + 1, sizeof (a + 1));
printf("a + 1L = %ld \t sizeof (a + 1) = %lu\n", a + 1L, sizeof (a + 1L)); //why a + 1L does not yield long integer ?
return 0;
}
これにより、次の出力が得られます。
a + 1 = -2147483648 sizeof (a + 1) = 4
a + 1L = 2147483648 sizeof (a + 1L) = 8
a + 1 = 0 sizeof (a + 1) = 4
a + 1L = 0 sizeof (a + 1) = 8
a + 1L
最後の行で 4294967296 のような長整数ではなく 0 が生成されるのはなぜですか?