title: Using -frepo option with G++
body: <p>My work place is developing code for some absolutely ancient hardware that doesn't have virtual memory. Because of this we're trying to be careful to minimize the text size of object and binary files, so we don't run out of memory. This likely means we'll need to limit the use of templates from the STL, or ban them outright. While looking around to find a way to minimize the size of our files, and still use templates, I came across the <code>-frepo</code> option for g++. A few tests later, I'm even more confused than when I started. The final binary file is the same size or larger when the -frepo is used, which doesn't make sense from me. Can anyone explain to me what this option actually does (other than "it just works," as that's the explanation from the GCC 4.7.1 manual) and how I might be abusing it?</p>
  
  <p>Compiling with <code>g++ -c -frepo main.cpp test8.cpp</code> and linking with <code>g++ test8.o main.o</code>
  The .rpo files arebeing created.</p>
  
  <p>test8.h:</p>
  
  <pre><code>#include &lt;list&gt;
  using namespace std;
  
  class Test
  {
    public:
      Test ();
      list&lt;int&gt; makeNewIntList ();
    private:
    list&lt;int&gt; intList;
  };
  </code></pre>
  
  <p>test8.cpp:</p>
  
  <pre><code>#include "test8.h"
  #include &lt;list&gt;
  
  using namespace std;
  
  Test::Test()
  {
    intList = list&lt;int&gt;( 10, 12 );
  }
  
  list&lt;int&gt; Test::makeNewIntList()
  {
    intList.push_back(4);
    return intList;
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "test8.h"
  
  using namespace std;
  
  void findFive (int num);
  list&lt;int&gt; makeIntList();
  
  int main( int argc, char* argv[])
  {
    Test test;
    list&lt;int&gt; intList = test.makeNewIntList();
    list&lt;int&gt; intList2 = makeIntList();
    list&lt;float&gt; floatList = list&lt;float&gt; (10,12);
    floatList.push_back(5);
  }
  
  list&lt;int&gt; makeIntList()
  {
    list&lt;int&gt; intList = list&lt;int&gt; (10,12);
    return intList;
  }
  </code></pre>
  
  <p>We are using GCC 4.1.2. Also note GCC 4.7.0 isn't much better, and upgrading the compiler isn't a viable solution.</p>