title: Cost of Default parameters in C++
body: <p>I stumbled through an example from "<em>Effective C++ in an Embedded Environment</em>" by Scott Meyers where two ways of using default parameters were described: one which was described as costly and the other as a better option.</p>
  
  <p>I am missing the explanation of why the first option might be more costly compared to the other one.</p>
  
  <pre><code>void doThat(const std::string&amp; name = "Unnamed"); // Bad
  
  const std::string defaultName = "Unnamed";
  void doThat(const std::string&amp; name = defaultName); // Better
  </code></pre>