aboutsummaryrefslogtreecommitdiffstats
path: root/docs/FAQ.html
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-29 19:14:35 +0000
committerChris Lattner <sabre@nondot.org>2004-03-29 19:14:35 +0000
commitc50bbc9613229ba3e21d64d62827fcc6c5d951cd (patch)
treefadf8b562b51fbc2698dd585b16eaebc9d7d77c8 /docs/FAQ.html
parent4dcb5401e4f6248eb546e4da444ba8e8cf306666 (diff)
downloadexternal_llvm-c50bbc9613229ba3e21d64d62827fcc6c5d951cd.zip
external_llvm-c50bbc9613229ba3e21d64d62827fcc6c5d951cd.tar.gz
external_llvm-c50bbc9613229ba3e21d64d62827fcc6c5d951cd.tar.bz2
Add a faq entry
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/FAQ.html')
-rw-r--r--docs/FAQ.html39
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/FAQ.html b/docs/FAQ.html
index 23c61cc..87e6c13 100644
--- a/docs/FAQ.html
+++ b/docs/FAQ.html
@@ -71,6 +71,9 @@
<li>What is this <tt>__main()</tt> call that gets inserted into
<tt>main()</tt>?</li>
<li>Where did all of my code go??</li>
+ <li>What is this <tt>llvm.global_ctors</tt> and
+ <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I
+ #include &lt;iostream&gt;?</li>
</ol>
</li>
</ol>
@@ -449,6 +452,42 @@ you can read from and assign to <tt>volatile</tt> global variables.
</p>
</div>
+<!--=========================================================================-->
+
+<div class="question"><p>
+What is this <tt>llvm.global_ctors</tt> and <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I #include &lt;iostream&gt;?
+</p></div>
+
+<div class="answer">
+<p>
+If you #include the &lt;iostream&gt; header into a C++ translation unit, the
+file will probably use the <tt>std::cin</tt>/<tt>std::cout</tt>/... global
+objects. However, C++ does not guarantee an order of initialization between
+static objects in different translation units, so if a static ctor/dtor in your
+.cpp file used <tt>std::cout</tt>, for example, the object would not necessarily
+be automatically initialized before your use.
+</p>
+
+<p>
+To make <tt>std::cout</tt> and friends work correctly in these scenarios, the
+STL that we use declares a static object that gets created in every translation
+unit that includes &lt;iostream&gt;. This object has a static constructor and
+destructor that initializes and destroys the global iostream objects before they
+could possibly be used in the file. The code that you see in the .ll file
+corresponds to the constructor and destructor registration code.
+</p>
+
+<p>
+If you would like to make it easier to <b>understand</b> the LLVM code generated
+by the compiler in the demo page, consider using printf instead of iostreams to
+print values.
+</p>
+</div>
+
+
+ <li>
+
+
<!-- *********************************************************************** -->
<!-- *********************************************************************** -->