1
0
mirror of https://github.com/golang/go synced 2024-11-24 19:50:18 -07:00

cleanup of unsafe documentation

R=r
DELTA=19  (4 added, 7 deleted, 8 changed)
OCL=28723
CL=28732
This commit is contained in:
Robert Griesemer 2009-05-12 21:37:46 -07:00
parent b66d703941
commit 98b4f6ac38

View File

@ -1306,7 +1306,7 @@ Functions:
cap len make new panic panicln print println
Packages:
sys (TODO: does sys endure?)
unsafe
</pre>
<h3>Exported identifiers</h3>
@ -4214,13 +4214,14 @@ following interface:
<pre class="grammar">
package unsafe
const Maxalign int
type ArbitraryType int // shorthand for an arbitrary Go type; it is not a real type
type Pointer *ArbitraryType
type Pointer *any // "any" is shorthand for any Go type; it is not a real type.
func Alignof(variable any) int
func Offsetof(selector any) int
func Sizeof(variable any) int
func Alignof(variable ArbitraryType) int
func Offsetof(selector ArbitraryType) int
func Reflect(i interface {}) (value uint64, typestring string, indir bool)
func Sizeof(variable ArbitraryType) int
func Unreflect(value uint64, typestring string, indir bool) interface {}
</pre>
<p>
@ -4253,18 +4254,14 @@ alignment of the (type of the) variable in bytes. For a variable
<pre>
uintptr(unsafe.Pointer(&amp;x)) % uintptr(unsafe.Alignof(x)) == 0
</pre>
<p>
The maximum alignment is given by the constant <code>Maxalign</code>.
It usually corresponds to the value of <code>Sizeof(x)</code> for
a variable <code>x</code> of the largest numeric type (8 for a
<code>float64</code>), but may
be smaller on systems with weaker alignment restrictions.
</p>
<p>
Calls to <code>Alignof</code>, <code>Offsetof</code>, and
<code>Sizeof</code> are constant expressions of type <code>int</code>.
</p>
<p>
<font color=red>TODO describe Reflect, Unreflect</font>
</p>
<h3>Size and alignment guarantees</h3>