mirror of
https://github.com/golang/go
synced 2024-11-11 23:50:22 -07:00
spec: adjust section on package unsafe for type parameters
Change-Id: I562d4648756e710020ee491f3801896563a89baa Reviewed-on: https://go-review.googlesource.com/c/go/+/367395 Trust: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
68da368a4e
commit
61ff501968
@ -642,7 +642,7 @@ an identifier denoting a constant,
|
|||||||
a <a href="#Constant_expressions">constant expression</a>,
|
a <a href="#Constant_expressions">constant expression</a>,
|
||||||
a <a href="#Conversions">conversion</a> with a result that is a constant, or
|
a <a href="#Conversions">conversion</a> with a result that is a constant, or
|
||||||
the result value of some built-in functions such as
|
the result value of some built-in functions such as
|
||||||
<code>unsafe.Sizeof</code> applied to any value,
|
<code>unsafe.Sizeof</code> applied to <a href="#Package_unsafe">certain values</a>,
|
||||||
<code>cap</code> or <code>len</code> applied to
|
<code>cap</code> or <code>len</code> applied to
|
||||||
<a href="#Length_and_capacity">some expressions</a>,
|
<a href="#Length_and_capacity">some expressions</a>,
|
||||||
<code>real</code> and <code>imag</code> applied to a complex constant
|
<code>real</code> and <code>imag</code> applied to a complex constant
|
||||||
@ -7446,8 +7446,14 @@ uintptr(unsafe.Pointer(&x)) % unsafe.Alignof(x) == 0
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Calls to <code>Alignof</code>, <code>Offsetof</code>, and
|
A (variable of) type <code>T</code> has <i>variable size</i> if <code>T</code>
|
||||||
<code>Sizeof</code> are compile-time constant expressions of type <code>uintptr</code>.
|
is a type parameter, or if it is an array or struct type containing elements
|
||||||
|
or fields of variable size. Otherwise the size is <i>constant</i>.
|
||||||
|
Calls to <code>Alignof</code>, <code>Offsetof</code>, and <code>Sizeof</code>
|
||||||
|
are compile-time <a href="#Constant_expressions">constant expressions</a> of
|
||||||
|
type <code>uintptr</code> if their arguments (or the struct <code>s</code> in
|
||||||
|
the selector expression <code>s.f</code> for <code>Offsetof</code>) are types
|
||||||
|
of constant size.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
Loading…
Reference in New Issue
Block a user