Commit db8c2b18 authored by Rob Pike's avatar Rob Pike

spec: clarify that result parameters are always zeroed before the function executes.

R=golang-dev
CC=golang-dev
https://golang.org/cl/1641043
parent 089da369
...@@ -4190,8 +4190,7 @@ func complex_f2() (re float, im float) { ...@@ -4190,8 +4190,7 @@ func complex_f2() (re float, im float) {
</li> </li>
<li>The expression list may be empty if the functions's result <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>). type specifies names for its result parameters (§<a href="#Function_Types">Function Types</a>).
The result parameters act as ordinary local variables that are The result parameters act as ordinary local variables
initialized to the zero values for their type (§<a href="#The_zero_value">The zero value</a>)
and the function may assign values to them as necessary. and the function may assign values to them as necessary.
The "return" statement returns the values of these variables. The "return" statement returns the values of these variables.
<pre> <pre>
...@@ -4204,6 +4203,10 @@ func complex_f3() (re float, im float) { ...@@ -4204,6 +4203,10 @@ func complex_f3() (re float, im float) {
</li> </li>
</ol> </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> <p>
<span class="alert"> <span class="alert">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment