mirror of
https://github.com/golang/go
synced 2024-11-24 22:37:56 -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:
parent
b66d703941
commit
98b4f6ac38
@ -1306,7 +1306,7 @@ Functions:
|
|||||||
cap len make new panic panicln print println
|
cap len make new panic panicln print println
|
||||||
|
|
||||||
Packages:
|
Packages:
|
||||||
sys (TODO: does sys endure?)
|
unsafe
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3>Exported identifiers</h3>
|
<h3>Exported identifiers</h3>
|
||||||
@ -4214,13 +4214,14 @@ following interface:
|
|||||||
<pre class="grammar">
|
<pre class="grammar">
|
||||||
package unsafe
|
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 ArbitraryType) int
|
||||||
|
func Offsetof(selector ArbitraryType) int
|
||||||
func Alignof(variable any) int
|
func Reflect(i interface {}) (value uint64, typestring string, indir bool)
|
||||||
func Offsetof(selector any) int
|
func Sizeof(variable ArbitraryType) int
|
||||||
func Sizeof(variable any) int
|
func Unreflect(value uint64, typestring string, indir bool) interface {}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -4253,18 +4254,14 @@ alignment of the (type of the) variable in bytes. For a variable
|
|||||||
<pre>
|
<pre>
|
||||||
uintptr(unsafe.Pointer(&x)) % uintptr(unsafe.Alignof(x)) == 0
|
uintptr(unsafe.Pointer(&x)) % uintptr(unsafe.Alignof(x)) == 0
|
||||||
</pre>
|
</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>
|
||||||
<p>
|
<p>
|
||||||
Calls to <code>Alignof</code>, <code>Offsetof</code>, and
|
Calls to <code>Alignof</code>, <code>Offsetof</code>, and
|
||||||
<code>Sizeof</code> are constant expressions of type <code>int</code>.
|
<code>Sizeof</code> are constant expressions of type <code>int</code>.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<font color=red>TODO describe Reflect, Unreflect</font>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<h3>Size and alignment guarantees</h3>
|
<h3>Size and alignment guarantees</h3>
|
||||||
|
Loading…
Reference in New Issue
Block a user