Skip to content

Go中int和int64的区别,各占多少位? #1

@qloog

Description

@qloog

可以查看官方说明:https://golang.google.cn/ref/spec#Numeric_types

int大小具体和操作系统有关,如果是在32位的操作系统则int大小和int32一致,如果是在64位操作系统则int大小和int64一致. 所以如果是在64位操作系统上int和int64的大小是一样的。

需要注意的是,即使int32(int64)和int在特定体系结构上可能具有相同的大小,它们也不是同一类型。

int32和int64大小如下:

int32       the set of all signed 32-bit integers (-2147483648 to 2147483647)
int64       the set of all signed 64-bit integers (-9223372036854775808 to 9223372036854775807)

如有问题欢迎继续补充说明。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions