LEFT | RIGHT |
(no file at all) | |
1 <!--{ | 1 <!--{ |
2 » "Title": "FAQ" | 2 » "Title": "FAQ", |
| 3 » "Path": "/doc/faq" |
3 }--> | 4 }--> |
4 | 5 |
5 <h2 id="Origins">Origins</h2> | 6 <h2 id="Origins">Origins</h2> |
6 | 7 |
7 <h3 id="What_is_the_purpose_of_the_project"> | 8 <h3 id="What_is_the_purpose_of_the_project"> |
8 What is the purpose of the project?</h3> | 9 What is the purpose of the project?</h3> |
9 | 10 |
10 <p> | 11 <p> |
11 No major systems language has emerged in over a decade, but over that time | 12 No major systems language has emerged in over a decade, but over that time |
12 the computing landscape has changed tremendously. There are several trends: | 13 the computing landscape has changed tremendously. There are several trends: |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 See the <a href="/doc/effective_go.html#allocation_new">relevant section | 1046 See the <a href="/doc/effective_go.html#allocation_new">relevant section |
1046 of Effective Go</a> for more details. | 1047 of Effective Go</a> for more details. |
1047 </p> | 1048 </p> |
1048 | 1049 |
1049 <h3 id="q_int_sizes"> | 1050 <h3 id="q_int_sizes"> |
1050 Why is <code>int</code> 32 bits on 64 bit machines?</h3> | 1051 Why is <code>int</code> 32 bits on 64 bit machines?</h3> |
1051 | 1052 |
1052 <p> | 1053 <p> |
1053 The sizes of <code>int</code> and <code>uint</code> are implementation-specific | 1054 The sizes of <code>int</code> and <code>uint</code> are implementation-specific |
1054 but the same as each other on a given platform. | 1055 but the same as each other on a given platform. |
1055 The 64 bit Go compilers (both gc and gccgo) use a 32 bit representation for | 1056 For portability, code that relies on a particular |
1056 <code>int</code>. Code that relies on a particular | |
1057 size of value should use an explicitly sized type, like <code>int64</code>. | 1057 size of value should use an explicitly sized type, like <code>int64</code>. |
| 1058 Prior to Go 1.1, the 64-bit Go compilers (both gc and gccgo) used |
| 1059 a 32-bit representation for <code>int</code>. As of Go 1.1 they use |
| 1060 a 64-bit representation. |
1058 On the other hand, floating-point scalars and complex | 1061 On the other hand, floating-point scalars and complex |
1059 numbers are always sized: <code>float32</code>, <code>complex64</code>, | 1062 numbers are always sized: <code>float32</code>, <code>complex64</code>, |
1060 etc., because programmers should be aware of precision when using | 1063 etc., because programmers should be aware of precision when using |
1061 floating-point numbers. | 1064 floating-point numbers. |
1062 The default size of a floating-point constant is <code>float64</code>. | 1065 The default size of a floating-point constant is <code>float64</code>. |
1063 </p> | 1066 </p> |
1064 | 1067 |
1065 <p> | 1068 <p> |
1066 At the moment, all implementations use 32-bit ints, an essentially arbitrary dec
ision. | 1069 At the moment, all implementations use 32-bit ints, an essentially arbitrary dec
ision. |
1067 However, we expect that <code>int</code> will be increased to 64 bits on 64-bit | 1070 However, we expect that <code>int</code> will be increased to 64 bits on 64-bit |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 <p> | 1697 <p> |
1695 On the topic of performance, keep in mind that Go gives the programmer | 1698 On the topic of performance, keep in mind that Go gives the programmer |
1696 considerable control over memory layout and allocation, much more than | 1699 considerable control over memory layout and allocation, much more than |
1697 is typical in garbage-collected languages. A careful programmer can reduce | 1700 is typical in garbage-collected languages. A careful programmer can reduce |
1698 the garbage collection overhead dramatically by using the language well; | 1701 the garbage collection overhead dramatically by using the language well; |
1699 see the article about | 1702 see the article about |
1700 <a href="http://blog.golang.org/2011/06/profiling-go-programs.html">profiling | 1703 <a href="http://blog.golang.org/2011/06/profiling-go-programs.html">profiling |
1701 Go programs</a> for a worked example, including a demonstration of Go's | 1704 Go programs</a> for a worked example, including a demonstration of Go's |
1702 profiling tools. | 1705 profiling tools. |
1703 </p> | 1706 </p> |
LEFT | RIGHT |