title: How to pass "literal" integers by reference in C++ (Newbie)
body: <p><strong>Edit:</strong> As many people have pointed out, pass-by-reference isn't generally appropriate as an optimisation for primitive types. This is excellent to know, so thank you all! Even so, my question was really more about why literal values can't seem be passed by reference, which has been addressed by the accepted answer. Cheers!</p>
  
  <hr>
  
  <p>(Forgive my naivety: I'm pretty new to C++.)</p>
  
  <p>To avoid the inefficiency of copy-by-value when calling a function (say, "fillRect"), I want to pass the parameters by reference.</p>
  
  <p>If I supply the parameters as declared local variables, it works fine. But if I supply any as "literal" integers, I get a compile error (no matching function).</p>
  
  <pre><code>void fillRect( int &amp;x, int &amp;y, int &amp;width, int &amp;height )
  {
      // do something
  }
  
  int x=10, y=20, w=100, h=80;
  
  fillRect(x, y, w, h); // this compiles and works!
  fillRect(x, y, 100, 80); // but this doesn't compile ... why?
  </code></pre>
  
  <p>What gives?</p>