首页 > 其他 > 详细

rune is alias of int32

时间:2016-08-06 20:28:16      阅读:213      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!