title: C/C++ style -- modifying function arguments
body: <p>Everyone knows that C/C++ function arguments are pass-by-value. So why do some people insist that correct style is to make a local copy of a function argument before modifying it?  For example, they would write:</p>
  
  <pre><code>void baz(unsigned int *ptr)
  {
    unsigned int *lPtr = ptr;
    for(int i = 0; i &lt; 10; i++)
    {
        foo(*lPtr++);
    }
  }
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>void baz(unsigned int *ptr)
  {
    for(int i = 0; i &lt; 10; i++)
    {
        foo(*ptr++);
    }
  }
  </code></pre>
  
  <p>It seems like the second way is easier to read since it is one less variable.</p>