From 28592ee1ea1f5cdffcf85472f9de0285d928cf12 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Wed, 3 Aug 2011 16:54:30 +0200 Subject: Imported Upstream version 59 --- doc/go_spec.html | 137 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 101 insertions(+), 36 deletions(-) (limited to 'doc/go_spec.html') diff --git a/doc/go_spec.html b/doc/go_spec.html index abf5b8f50..489ad4db3 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,5 +1,5 @@ - + +

+ +

+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.

Fallthrough statements

@@ -4590,11 +4650,14 @@ Two built-in functions assist in common slice operations.

-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 struct s with field f:
 

-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) == 0
 

Calls to Alignof, Offsetof, and -Sizeof are compile-time constant expressions of type int. +Sizeof are compile-time constant expressions of type uintptr.

The functions unsafe.Typeof, @@ -5198,10 +5261,12 @@ The following minimal alignment properties are guaranteed: -

Implementation differences - TODO

+ +

Implementation differences - TODO

    -
  • The restriction on goto statements and targets (no intervening declarations) is not honored.
  • -
  • len(a) is only a constant if a 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 if a 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, and unsafe.Sizeof return an int.
+
-- cgit v1.2.3