Commit f5c07634 authored by Rob Pike's avatar Rob Pike

Explain about pointer types for mutually recursive structures.

SVN=117463
parent 5e391cff
...@@ -683,6 +683,15 @@ We do not allow pointer arithmetic of any kind. ...@@ -683,6 +683,15 @@ We do not allow pointer arithmetic of any kind.
*int *int
*map[string] *chan *map[string] *chan
It is legal to write a pointer type (only) such as *T or **T even if T
is not yet defined as a type name. This allows the construction of
mutually recursive data types such as structs:
type S1 struct { s2 *S2 } // S2 is not yet declared
type S2 struct { s1 *S1 }
By the end of the package source, such types must be fully declared.
There are no pointer literals. There are no pointer literals.
......
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