title: Why does C++ code missing a formal argument name in a function definition compile without warnings?
body: <p>While getting started with some VS2005-generated MFC code, I noticed it overrode a method with something like this:</p>
  
  <pre><code>void OnDraw(CDC* /*pDC*/)
  {
      ...
      // TODO: Add your code here
  }
  </code></pre>
  
  <p>So of course, as soon as I added something I realized I needed to un-comment the pDC formal argument in order to compile, but I'm confused as to how/why a C++ function can compile (with no warnings) when the formal argument only has a type and not a name:</p>
  
  <pre><code>void foo(int)
  {
      int x = 3;
  }
  int main()
  {
      foo(5);
      return 0;
  }
  </code></pre>
  
  <p>Shouldn't this generate at least a warning (with -Wall or /W4)? It doesn't seem to. Am I missing something? Is there a case where this is useful or is it just because the compiler can't tell the difference between a function declaration (only types required) and a definition (fully specified) until after the line has been processed?</p>