切片、map 与泛型:内存机制与使用规范
函数内对形参切片执行 append,不会反映到调用方一侧:append 操作的是函数内那份 24 字节切片头副本,而非调用方持有的头部。解释这类行为,需要考察运行时层面的三个事实:slice 的内存布局、map 并发读写触发 fatal error 的机制,以及 make 预分配能省去多少次中间拷贝。
10 min read
Loading…
Quote of the day · November 15关于接受Breaking Bad
You got the job. Do yourself a favor and learn to take yes for an answer.
Notes on Agent runtimes — design decisions laid open: why it is this way, what it costs, and when it stops being true.