From 28592ee1ea1f5cdffcf85472f9de0285d928cf12 Mon Sep 17 00:00:00 2001
From: Ondřej Surý
+A "goto" statement outside a block cannot jump to a label inside that block. +For instance, this example: +
+ ++if n%2 == 1 { + goto L1 +} +for n > 0 { + f() + n-- +L1: + f() + n-- +} ++ +
+is erroneous because the label L1
is inside
+the "for" statement's block but the goto
is not.
-The function append
appends zero or more values x
+The variadic function append
+appends zero or more values x
to s
of type S
, which must be a slice type, and
returns the resulting slice, also of type S
.
-Each value x
must be assignable to
-the element type of S
.
+The values x
are passed to a parameter of type ...T
+where T
is the element type of
+S
and the respective
+parameter passing rules apply.
@@ -5102,9 +5165,9 @@ package unsafe type ArbitraryType int // shorthand for an arbitrary Go type; it is not a real type type Pointer *ArbitraryType -func Alignof(variable ArbitraryType) int -func Offsetof(selector ArbitraryType) int -func Sizeof(variable ArbitraryType) int +func Alignof(variable ArbitraryType) uintptr +func Offsetof(selector ArbitraryType) uinptr +func Sizeof(variable ArbitraryType) uintptr func Reflect(val interface{}) (typ runtime.Type, addr uintptr) func Typeof(val interface{}) (typ interface{}) @@ -5127,7 +5190,7 @@ For a structs
with fieldf
:-uintptr(unsafe.Pointer(&s)) + uintptr(unsafe.Offsetof(s.f)) == uintptr(unsafe.Pointer(&s.f)) +uintptr(unsafe.Pointer(&s)) + unsafe.Offsetof(s.f) == uintptr(unsafe.Pointer(&s.f))@@ -5140,12 +5203,12 @@ alignment of the (type of the) variable in bytes. For a variable
-uintptr(unsafe.Pointer(&x)) % uintptr(unsafe.Alignof(x)) == 0 +uintptr(unsafe.Pointer(&x)) % unsafe.Alignof(x) == 0Calls to
Alignof
,Offsetof
, and -Sizeof
are compile-time constant expressions of typeint
. +Sizeof
are compile-time constant expressions of typeuintptr
.The functions
unsafe.Typeof
, @@ -5198,10 +5261,12 @@ The following minimal alignment properties are guaranteed: -Implementation differences - TODO
+ +Implementation differences - TODO
-
+ -- cgit v1.2.3- The restriction on
-goto
statements and targets (no intervening declarations) is not honored.- -
len(a)
is only a constant ifa
is a (qualified) identifier denoting an array or pointer to an array.- -
nil
maps are not treated like empty maps.- Trying to send/receive from a
+nil
channel causes a run-time panic.- +
len(a)
is only a constant ifa
is a (qualified) identifier denoting an array or pointer to an array.- +
nil
maps are not treated like empty maps.- Trying to send/receive from a
+nil
channel causes a run-time panic.unsafe.Alignof
,unsafe.Offsetof
, andunsafe.Sizeof
return anint
.