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

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

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

10条回答
  •  不知归路
    2020-11-22 12:32

    Data Types Size depends on Processor, because compiler wants to make CPU easier accessible the next byte. for eg: if processor is 32bit, compiler may not choose int size as 2 bytes[which it supposed to choose 4 bytes] because accessing another 2 bytes of that int(4bytes) will take additional CPU cycle which is waste. If compiler chooses int as 4 bytes CPU can access full 4 bytes in one shot which speeds your application.

    Thanks

提交回复
热议问题