summaryrefslogtreecommitdiff
path: root/doc/go_for_cpp_programmers.html
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-10-01 14:12:18 -0700
committerRobert Griesemer <gri@golang.org>2009-10-01 14:12:18 -0700
commit23115257405106898dc2305761348dbe12bd6755 (patch)
treec0677a5f8d19ed789e557cc406ea6f1bf1d77031 /doc/go_for_cpp_programmers.html
parent2402780f5fd37ffc355df81c539bdd09a526c3f9 (diff)
downloadgolang-23115257405106898dc2305761348dbe12bd6755.tar.gz
use the notion of "untyped constant" instead of "ideal constant"
R=iant DELTA=13 (1 added, 0 deleted, 12 changed) OCL=35241 CL=35246
Diffstat (limited to 'doc/go_for_cpp_programmers.html')
-rw-r--r--doc/go_for_cpp_programmers.html19
1 files changed, 10 insertions, 9 deletions
diff --git a/doc/go_for_cpp_programmers.html b/doc/go_for_cpp_programmers.html
index 055242f71..d6d4329ba 100644
--- a/doc/go_for_cpp_programmers.html
+++ b/doc/go_for_cpp_programmers.html
@@ -257,21 +257,22 @@ You cannot write <code>c = *p++</code>. <code>*p++</code> is parsed as
<h2 id="Constants">Constants </h2>
<p>
-In Go integer and floating-point constants have so-called ideal types.
-This applies even to constants named with a <code>const</code> 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 <i>untyped</i>. This applies even to constants
+named with a <code>const</code> 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.
<pre>
-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
</pre>
<p>
-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.
<pre>
const huge = 1 &lt;&lt; 100; f(huge &gt;&gt; 98)