码迷,mamicode.com
首页 > 其他好文 > 详细

rune is alias of int32

时间:2016-08-06 20:30:13      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:

I think chendesheng‘s quote gets at the root cause best: Go uses a lot of signed values, not just for runes but array indices, Read/Write byte counts, etc. That‘s because uints, in any language, behave confusingly unless you guard every piece of arithmetic against overflow (for example if var a, b uint = 1, 2, a-b > 0 and a-b > 1000000: play.golang.org/p/lsdiZJiN7V). ints behave more like numbers in everyday life, which is a compelling reason to use them, and there is no equally compelling reason not to use them.

 

 

http://stackoverflow.com/questions/24714665/why-is-rune-in-golang-an-alias-for-int32-and-not-uint32

rune is alias of int32

标签:

原文地址:http://www.cnblogs.com/jvava/p/5744744.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!