What's the difference between `usize` and `u32`?

前端 未结 2 645
执笔经年
执笔经年 2020-12-13 11:57

The documentation says usize is

Operations and constants for pointer-sized unsigned integers.

In most cases, I can

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 12:46

    Adding to @Levans' answer,

    The size of usize is depended on how much size it takes to reference any location in memory.

    on a 32 bit target usize is 4 bytes and on a 64 bit target usize is 8 bytes

提交回复
热议问题