Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Function Prototypes a\And Variable Names Versus Data Types Only

When declaring a function prototype in C++ is there a difference between the following:

void SomeFunction( int Argument ) 
{
    //Stuff
} 

Versus

void SomeFunction( int ) 
{
    //Stuff
} 

Essentially what I'm asking, is why do you write a variable argument name in the prototype of the function rather than just the data type?

like image 830
user990683 Avatar asked Dec 28 '22 12:12

user990683


1 Answers

Argument names are not needed for compiler in function declarations. It is for human consumption. They give additional information on what the function is doing. Good function names coupled with good argument names serve as instant documentation for your method.

like image 171
seva titov Avatar answered Jan 22 '23 11:01

seva titov