From: Robert Griesemer
Date: Mon, 17 Sep 2012 19:23:41 +0000 (-0700)
Subject: spec: unsafe.Alignof/Sizeof also accept non-variable arguments
X-Git-Tag: go1.1rc2~2437
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c7631f555f880409fb13143d0d8236ad9fb99c2c;p=gostls13.git
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
---
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 72582d4a17..fc61bdd4c0 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
@@ -5487,8 +5487,9 @@ Any pointer or value of underlying type uintptr
Pointer and vice versa.
-The function Sizeof
takes an expression denoting a
-variable of any type and returns the size of the variable in bytes.
+The functions Alignof
and Sizeof
take an expression x
+of any type and return the alignment or size, respectively, of a hypothetical variable v
+as if v
was declared via var v = x
.
The function Offsetof
takes a selector (§Selectors) denoting a struct