I remember reading before about the significance (or lack thereof) between including a parameter name in a function declaration and not including one. But I can't remember what it was that I read or where I read it.
for example,
void do_something(int *); // No parameter name included, only type.
vs...
void do_something(int * i); // type AND parameter name included.
So what's the difference between these two declarations? Thanks for reading and maybe answering this possibly trivial question.
-- UPDATE --
Okay, so the thing I had read was a set of style guidelines from an old professor of mine warning against including a parameter name in function definition and NOT using the parameter in the function.
void do_something(int * i) { //code that doesn't use i;} //BAD
void do_something(int *) { //code that doesn't use i;} //OK
There is no difference, as far as the compiler is concerned.
Adding meaningful parameter names is a helpful form of documentation, though.
The difference is that the second version could be more readable if you choose a good parameter name. Nothing more to say ;-)
There is no technical difference between those declarations. If you instead had
void accumulate_stats(int * count);
or something similarly descriptive, it would be an improvement in self-documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With