]> Cypherpunks repositories - gostls13.git/commitdiff
go spec: clarify return statement rules
authorRobert Griesemer <gri@golang.org>
Tue, 8 Mar 2011 00:29:07 +0000 (16:29 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 8 Mar 2011 00:29:07 +0000 (16:29 -0800)
Added example of a return statement w/o expressions
in a function with a _ result parameter.

See also: http://code.google.com/p/go/issues/detail?id=1586

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4266049

doc/go_spec.html

index 85dfc44bdac00300633155c87aa2b0e093cedf0c..c29538e6a3153a4564502939d1c8406de78c32b7 100644 (file)
@@ -1,5 +1,5 @@
 <!-- title The Go Programming Language Specification -->
-<!-- subtitle Version of March 3, 2011 -->
+<!-- subtitle Version of March 7, 2011 -->
 
 <!--
 TODO
@@ -4212,7 +4212,7 @@ func complex_f2() (re float64, im float64) {
 </pre>
        </li>
        <li>The expression list may be empty if the function'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
                and the function may assign values to them as necessary.
                The "return" statement returns the values of these variables.
@@ -4222,6 +4222,11 @@ func complex_f3() (re float64, im float64) {
        im = 4.0
        return
 }
+
+func (devnull) Write(p []byte) (n int, _ os.Error) {
+       n = len(p)
+       return
+} 
 </pre>
        </li>
 </ol>