From c7631f555f880409fb13143d0d8236ad9fb99c2c Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 17 Sep 2012 12:23:41 -0700 Subject: [PATCH] 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 --- doc/go_spec.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 uintptrPointer 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