This commit is contained in:
chai2010 2015-12-28 21:55:06 +08:00
parent fc2e1a20c5
commit fde6468092
2 changed files with 1 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{
"title": "Go编程语言",
"title": "Go语言圣经",
"description": "<The Go Programming Language>中文版",
"language": "zh",
"structure": {

View File

@ -124,8 +124,6 @@ make([]T, len)
make([]T, len, cap) // same as make([]T, cap)[:len]
```
Under the hood, make creates an unnamed array variable and returns a slice of it; the array is accessible only through the returned slice. In the first form, the slice is a view of the entire array. In the second, the slice is a view of only the arrays first len elements, but its capacity includes the entire array. The additional elements are set aside for future growth.
在底層make創建了一個匿名的數組變量然後返迴一個slice隻有通過返迴的slice才能引用底層匿名的數組變量。在第一種語句中slice是整個數組的view。在第二個語句中slice隻引用了底層數組的前len個元素但是容量將包含整個的數組。額外的元素是留給未來的增長用的。
{% include "./ch4-02-1.md" %}