我爱编程

golang byte and rune

2018-07-25  本文已影响0人  夜空一起砍猩猩

cat $GOROOT/src/builtin/builtin.go

package builtin

type byte byte

byte is an alias for uint8 and is equivalent to uint8 in all ways.It is   // used, by convention, to distinguish byte values from 8-bit unsigned   // integer values.   

Really: type byte = uint8 (see golang.org/issue/21601)      

type rune rune

rune is an alias for int32 and is equivalent to int32 in all ways.

It is  used, by convention, to distinguish character values from integer values.

Really: type rune = int32 (see golang.org/issue/21601)  

上一篇 下一篇

猜你喜欢

热点阅读