Comments (5)
抱歉还没来得及看,为什么又关掉了?
from goexpertprogramming.
那13.1节的扩容分析感觉不是问题所在,即使不扩容,只要不接收返回返回值,原来的slice也不会变化。
如果append时没有发生扩容,原来的slice也是变化的(元素增多了)。
from goexpertprogramming.
嗯,如果append没有使slice扩容,slice指向的底层数组是同一个,且里面元素发生变化。但是append是值传递,对于原slice来说,如果不接收返回值,它的len不会改变,所以底层数组的变化不会体现到它上面。所以我感觉问题不在于是否发生扩容。(这种情况 slice没有扩容,错误信息也是不会返回)。(不知道我理解的是否有偏差)
from goexpertprogramming.
是的,我也是这么理解的。
所以,你觉得13.1节需要改,还是13.3节需要改。建议如何改?
from goexpertprogramming.
原文“append()函数每次追加元素都有可能触发切片扩容,即有可能返回一个新的切片”,这里的“即有可能”是不是可以去掉呀,我理解的是每次都会返回新切片(即使共享底层数组的情况也算一个新切片吧?)。我觉得13.1的例子可以合并到13.3中😂。
from goexpertprogramming.
Related Issues (20)
- [建议] 5.3 context可以把例子前移么 HOT 2
- [勘误]反馈一个第2章第2.2节的示例运行结果错误 HOT 3
- [勘误]反馈一个第1章第3节的内容错误 HOT 9
- [勘误]反馈一个第1章第3.3节的流程图 HOT 2
- [勘误]反馈一个第1章第1.2节的运行结果错误 HOT 3
- [勘误]反馈一个第2章第2.3节的错别字 HOT 1
- [勘误]反馈一个第一章第2节的错别字 HOT 1
- [勘误]反馈一个第M章第N节的错别字 HOT 2
- [勘误]反馈一个第3章第1节的错别字 HOT 7
- 关于3.2G0系统调用描述问题探讨 HOT 1
- [勘误]反馈一个第一章第二节中关于slice扩容问题 HOT 7
- [勘误]反馈一个第5章第3节的context描述错误 HOT 6
- [勘误]反馈一个第4章 4.1内存分配的配图问题 HOT 1
- [勘误]反馈一个第1章第3节的问题 HOT 3
- 关于13.1节的疑问
- [勘误]反馈一个第1章第2节,关于切片简单表达式的 cap 取值问题 HOT 2
- [勘误]反馈一个第1章第3节的错别字 HOT 2
- [勘误]反馈一个第2章第2节的错别字 HOT 1
- [勘误]反馈一个第一章第一节的错误 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goexpertprogramming.