知识卡片
数值与布尔类型各有边界
整数可选明确位宽的有符号/无符号类型,int与uint宽度依实现;浮点为float32/64,复数为complex64/128,可用带i的字面量。byte是uint8别名,rune是int32别名,bool是独立的真假类型。后两项纠正原稿的uint32和一位整数说法;类型选择应由取值范围与语义决定。
语法示例:var r rune = '中';z := 1 + 2i。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Go Language Foundations · 查看原书依据
Go has a small menagerie of systematically-named, floating-point and signed and unsigned integer numbers: Signed Integer int8, int16, int32, int64 Unsigned Integer uint8, uint16, uint32, uint64 Floating-Point float32, float64 Systematic naming is nice, but code is written by humans with squishy human brains, so the Go designers provided two lovely conveniences. First, there are two
参考来源
- 位置:《Cloud Native Go》第03章《Go Language Foundations》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch03.xhtml)
- 结论依据:整数可选明确位宽的有符号/无符号类型,int与uint宽度依实现;浮点为float32/64,复数为complex64/128,可用带i的字面量。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。
- 原始内容:Go has a small menagerie of systematically-named, floating-point and signed and unsigned integer numbers: Signed Integer int8, int16, int32, int64 Unsigned Integer uint8, uint16, uint32, uint64 Floating-Point float32, float64 Systematic naming is nice, but code is written by humans with squishy human brains, so the Go designers provided two lovely conveniences. First, there are two