Commit 0a5508c6 authored by Rob Pike's avatar Rob Pike

various: we don't cast, we convert

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5437142
parent ca7d86c4
......@@ -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 {
......
......@@ -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,
......
......@@ -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:
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment