Short Size

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Short Size

1,193件の閲覧回数
carlosmscabral
Contributor I
Hello there,

Using the compiler option 4-byte integer, a short will have, always, 2 bytes?

I can't understand exactaly the definitions of uint32, uint16... and how the compiler handles them.

Thanks
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

306件の閲覧回数
admin
Specialist II
> Using the compiler option 4-byte integer, a short will have, always, 2 bytes?
No, this is an architecture dependent.
But, sizeof(short int) is 2 bytes for all known to me 32-bit architectures.
 
> I can't understand exactly the definitions of uint32, uint16... and how the compiler handles them.
Regularly, UINT32 has the range from 0 to 2^31-1.
Regularly, UINT16 has the range from 0 to 2^15-1.
 
0 件の賞賛
返信

306件の閲覧回数
JimDon
Senior Contributor III

The purpose of uint32, uint16 etc. is that they are adjusted for the environment you are in so that they are always that size regardless.

So if you use uint32, and you change compilers, processor, or compile options these are adjustedt in one place, vs all over if you use unsigned int.

0 件の賞賛
返信