From: Andrew Gerrand
diff --git a/doc/go_faq.html b/doc/go_faq.html
index 3f9c1d246d..6258f5808b 100644
--- a/doc/go_faq.html
+++ b/doc/go_faq.html
@@ -677,6 +677,28 @@ floating-point numbers.
The default size of a floating-point constant is
float64
.
+From a correctness standpoint, you don't need to know. +Each variable in Go exists as long as there are references to it. +The storage location chosen by the implementation is irrelevant to the +semantics of the language. + +
+The storage location does have an effect on writing efficient programs. +When possible, the Go compilers will allocate variables that are +local to a function in that function's stack frame. However, if the +compiler cannot prove that the variable is not referenced after the +function returns, then the compiler must allocate the variable on the +garbage-collected heap to avoid dangling pointer errors. + +
+In the current compilers, the analysis is crude: if a variable has its address +taken, that variable is allocated on the heap. We are working to improve this +analysis so that more data is kept on the stack. +
gccgo
.
+
+The gc tool chain (5l
, 6l
, and 8l
) only
+generate statically linked binaries. All Go binaries therefore include the Go
+run-time, along with the run-time type information necessary to support dynamic
+type checks, reflection, and even panic-time stack traces.
+
+
+A trivial C "hello, world" program compiled and linked statically using gcc +on Linux is around 750 kB. An equivalent Go program is around 1.8 MB, but +that includes a more powerful runtime. We believe that with some effort +the size of Go binaries can be reduced. +