1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:57:58 -07:00

Explain about pointer types for mutually recursive structures.

SVN=117463
This commit is contained in:
Rob Pike 2008-05-01 23:51:33 -07:00
parent 5e391cff2c
commit f5c0763432

View File

@ -683,6 +683,15 @@ We do not allow pointer arithmetic of any kind.
*int
*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.