Does the size of an int depend on the compiler and/or processor?

前端 未结 10 1445
借酒劲吻你
借酒劲吻你 2020-11-22 11:58

Would the size of an integer depend upon the compiler, OS and processor?

10条回答
  •  [愿得一人]
    2020-11-22 12:44

    Yes, it would. Did they mean "which would it depend on: the compiler or the processor"? In that case the answer is basically "both." Normally, int won't be bigger than a processor register (unless that's smaller than 16 bits), but it could be smaller (e.g. a 32-bit compiler running on a 64-bit processor). Generally, however, you'll need a 64-bit processor to run code with a 64-bit int.

提交回复
热议问题