various: we don't cast, we convert

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5437142
This commit is contained in:
Rob Pike 2011-12-05 19:40:52 -08:00
parent ca7d86c4d3
commit 0a5508c692
4 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@ type bitReader struct {
err error
}
// bitReader needs to read bytes from an io.Reader. We attempt to cast the
// bitReader needs to read bytes from an io.Reader. We attempt to convert the
// given io.Reader to this interface and, if it doesn't already fit, we wrap in
// a bufio.Reader.
type byteReader interface {

View File

@ -61,7 +61,7 @@ func dial(t *testing.T) *ClientConn {
WantReply bool
Status uint32
}
// TODO(dfc) casting to the concrete type should not be
// TODO(dfc) converting to the concrete type should not be
// necessary to send a packet.
msg := exitMsg{
PeersId: ch.(*channel).theirId,

View File

@ -103,7 +103,7 @@
To avoid recursion in cases such as
type X string
func (x X) String() string { return Sprintf("<%s>", x) }
cast the value before recurring:
convert the value before recurring:
func (x X) String() string { return Sprintf("<%s>", string(x)) }
Format errors:

View File

@ -32,8 +32,8 @@ var PrintRanges = []*RangeTable{
// Such characters include letters, marks, numbers, punctuation, symbols, and
// spaces, from categories L, M, N, P, S, Zs.
func IsGraphic(r rune) bool {
// We cast to uint32 to avoid the extra test for negative,
// and in the index we cast to uint8 to avoid the range check.
// We convert to uint32 to avoid the extra test for negative,
// and in the index we convert to uint8 to avoid the range check.
if uint32(r) <= MaxLatin1 {
return properties[uint8(r)]&pg != 0
}