summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-06-11 21:30:03 -0700
committerRob Pike <r@golang.org>2010-06-11 21:30:03 -0700
commit4321eeca8945da697391dc4fb309a820e1b753cb (patch)
tree9e53ce2f54dde6cf94a74b5680d07424c4378857
parent30cc53509d0a0fde1436bd3269d589e763a49aa2 (diff)
downloadgolang-4321eeca8945da697391dc4fb309a820e1b753cb.tar.gz
spec: clarify that result parameters are always zeroed before the function executes.
R=golang-dev CC=golang-dev http://codereview.appspot.com/1641043
-rw-r--r--doc/go_spec.html7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 9e0994707..e2637d96c 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -4190,8 +4190,7 @@ func complex_f2() (re float, im float) {
</li>
<li>The expression list may be empty if the functions's result
type specifies names for its result parameters (§<a href="#Function_Types">Function Types</a>).
- The result parameters act as ordinary local variables that are
- initialized to the zero values for their type (§<a href="#The_zero_value">The zero value</a>)
+ The result parameters act as ordinary local variables
and the function may assign values to them as necessary.
The "return" statement returns the values of these variables.
<pre>
@@ -4204,6 +4203,10 @@ func complex_f3() (re float, im float) {
</li>
</ol>
+<p>
+Regardless of how they are declared, all the result values are initialized to the zero values for their type (§<a href="#The_zero_value">The zero value</a>) upon entry to the function.
+</p>
+
<!---
<p>
<span class="alert">