title: Practical Applications or Value of Function Prototype Scope
body: <p>First off: When searching for answers, I am allowed to [tag] the areas to search. This posting interface should support that too.</p>
  
  <p>Besides error checking which only requires types, not identifiers, what are some of the practical applications one might encounter for leveraging function prototype scope? What are some of the advantages to this?</p>
  
  <pre><code>function(int index, float array[index]);
  //function prototype with names
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>function(int, float);
  //function prototype(without identifiers)...
  </code></pre>
  
  <p>The definition of a function always includes the return argumen, function name and function arguments including the type and names It seem that having a prototype scope would be redundant since the arguments are re-declared anyways with names:</p>
  
  <p>Prototype:
      return_type return_name(argument_type, ...);</p>
  
  <p>Function Declaration:</p>
  
  <pre><code>return_type return_name(argument_type argument_name, ...){
      compound_statement_function_block;
  }
  </code></pre>
  
  <p>The only value I can see is that it reserves the function name within the file scope namespace meaning the function name could be used within the prototype:</p>
  
  <pre><code>int func(int func);    //Proto type declaration. Compiler allows this
                         //but throws warning about func() redeclaration
                         //but nothing about the arguments.
  
  int function(int function){
      int function;
  }
  </code></pre>
  
  <p>I had originally thought that the scope was independent of names meaning file_scope_variable_name was different than file_scope_function_name. They are contextually and significantly different enough to be such and I thought that is what the standard called for however the compiler I am using, gcc, won't allow it. It will however allow main re-declared as a tag in the struct/union name space at any scope since they a block element like a function:</p>
  
  <pre><code>int func(int func){
      typedef struct {
          int func;
      };                 //Cannot use func as a variable name at function scope 
                         //since it is an argument even though 
                         //this is within a different namespace
      typedef union func{
          int (*func)(int func); //Shows func() name and arg. names
                                 //are different namespaces.
          union u{
              int func;
              //...
          }
      } ;
  }
  
  int main(int main){
      typedef struct main {
          int main;
      };
  }
  </code></pre>
  
  <p>It seems 'main' is a reserved keyword at the file level for variable names and function names but not struct/tag union names. It accepts this at the file level:</p>
  
  <pre><code>struct main {
      int main;
      //...
  } not_main;
  </code></pre>
  
  <p>It makes no sense why the namespaces are as such for the prototype. If it didn't have some practical utility, it wouldn't be a distinction.</p>