mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 04:22:22 +00:00
Update ch2-07-memory.md
fix code. byte 溢出 `constant 1234 overflows byte`
This commit is contained in:
parent
4fdab8dfce
commit
3fa2700598
@ -32,9 +32,9 @@ func freeByteSlice(p []byte) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
s := makeByteSlize(1<<32+1)
|
s := makeByteSlize(1<<32+1)
|
||||||
s[len[s]-1] = 1234
|
s[len(s)-1] = 255
|
||||||
print(s[len[s]-1])
|
print(s[len(s)-1])
|
||||||
freeByteSlice(p)
|
freeByteSlice(s)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user