3-byte int and 5-byte long?

前端 未结 4 1388
独厮守ぢ
独厮守ぢ 2020-11-29 08:39

Does each of C and C++ standards allow sizeof of numeric types not to be a power of two?

The following constraints are known:

4条回答
  •  死守一世寂寞
    2020-11-29 09:22

    The C++ standard (and almost certainly the C standard, but I haven't looked at it for a very long time) does not have a rule that says anything about the NUMBER of bits that a type should be. I know for a fact that 9-bit char is allowed, and there are machines with 36-bit integers. Last time I checked, neither 9 or 36 are powers of 2.

提交回复
热议问题