mirror of
https://github.com/golang/go
synced 2024-11-22 07:14:40 -07:00
&Foo{x,y} wasn't in the spec. This gets it in, dependent on a proper section regarding
address operators, to follow. R=rsc DELTA=11 (10 added, 0 deleted, 1 changed) OCL=26529 CL=26532
This commit is contained in:
parent
70c1a106e6
commit
37ab838d3a
@ -1906,7 +1906,17 @@ one may write
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
pi := Num{Rat{22, 7}, 3.14159, "pi"};
|
pi := Num{Rat{22, 7}, 3.14159, "pi"}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Since evaluation of a literal creates a new value, taking the address of a
|
||||||
|
composite literal (§Address operators) generates a pointer to a unique
|
||||||
|
instance of the literal's value.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
var pi_ptr *Rat = &Rat{22, 7}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
Loading…
Reference in New Issue
Block a user