为什么我在 Xcode 上得到不同的结果(C 语言)

Why do I get different result on Xcode (C Language)

long number = 100;
printf("the sizeof: %d", sizeof(number));

在Visual Studio中,我得到了结果4。 在 Xcode 中,我得到结果 8.

相同的代码,不同的结果。你能告诉我为什么我得到这个结果吗?

参见here:标准保证long为"at least 32 bits",根据数据模型可能会更大。

如果你想要"exactly 32 bits",试试看是否支持int32_t