mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
spec: unsafe.Alignof/Sizeof also accept non-variable arguments
Both gc and gccgo permit calls such as unsafe.Sizeof(42). The spec only permits variable arguments. This is a (backward-compatible) spec change reflecting the status quo. Seems preferrable over restricting the compilers. R=r, rsc, iant, ken CC=golang-dev https://golang.org/cl/6494140
This commit is contained in:
parent
af832ac0b9
commit
c7631f555f
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
<!--{
|
||||
"Title": "The Go Programming Language Specification",
|
||||
"Subtitle": "Version of September 13, 2012",
|
||||
"Subtitle": "Version of September 17, 2012",
|
||||
"Path": "/ref/spec"
|
||||
}-->
|
||||
|
||||
|
@ -5487,8 +5487,9 @@ Any pointer or value of <a href="#Types">underlying type</a> <code>uintptr</code
|
|||
a <code>Pointer</code> and vice versa.
|
||||
</p>
|
||||
<p>
|
||||
The function <code>Sizeof</code> takes an expression denoting a
|
||||
variable of any type and returns the size of the variable in bytes.
|
||||
The functions <code>Alignof</code> and <code>Sizeof</code> take an expression <code>x</code>
|
||||
of any type and return the alignment or size, respectively, of a hypothetical variable <code>v</code>
|
||||
as if <code>v</code> was declared via <code>var v = x</code>.
|
||||
</p>
|
||||
<p>
|
||||
The function <code>Offsetof</code> takes a selector (§<a href="#Selectors">Selectors</a>) denoting a struct
|
||||
|
|
Loading…
Reference in a new issue