From: Robert Griesemer Date: Thu, 1 Oct 2009 21:12:18 +0000 (-0700) Subject: use the notion of "untyped constant" instead of "ideal constant" X-Git-Tag: weekly.2009-11-06~432 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a27f1f7475f13cec8637145239fcec7c84c2ccaa;p=gostls13.git use the notion of "untyped constant" instead of "ideal constant" R=iant DELTA=13 (1 added, 0 deleted, 12 changed) OCL=35241 CL=35246 --- diff --git a/doc/go_for_cpp_programmers.html b/doc/go_for_cpp_programmers.html index 055242f716..d6d4329ba8 100644 --- a/doc/go_for_cpp_programmers.html +++ b/doc/go_for_cpp_programmers.html @@ -257,21 +257,22 @@ You cannot write c = *p++. *p++ is parsed as

Constants

-In Go integer and floating-point constants have so-called ideal types. -This applies even to constants named with a const declaration, -if no -type is given in the declaration. An ideal type becomes concrete when -it is actually used. This permits constants to be used relatively +In Go constants may be untyped. This applies even to constants +named with a const declaration if no +type is given in the declaration and the initializer expression uses only +untyped constants. +An untyped constant becomes typed when it is used within a context that +requires a typed value. This permits constants to be used relatively freely without requiring general implicit type conversion.

-var a uint; f(a + 1)  // Ideal type of "1" becomes "uint".
+var a uint; f(a + 1)  // untyped numeric constant "1" becomes typed as uint
 

-The language does not impose any limits on the size of an abstract -integer constant or constant expression. A limit is only applied when -a constant expression is used where a type is required. +The language does not impose any limits on the size of an untyped +numeric constant or constant expression. A limit is only applied when +a constant is used where a type is required.

 const huge = 1 << 100; f(huge >> 98)