On 32-bit CPUs, is an 'integer' type more efficient than a 'short' type?

前端 未结 8 1586
离开以前
离开以前 2020-11-29 09:30

On a 32-bit CPU, an integer is 4 bytes and a short integer is 2 bytes. If I am writing a C/C++ application that uses many numeric values that will always fit within the pro

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 10:22

    Don't listen to the advice, try it.

    This is probably going to depend heavily on the hardware/compiler that you're using. A quick test should make short work of this question. Probably less time to write the test than it is to write the question here.

提交回复
热议问题