I wanted to know what the difference between the following two declarations is in header files I have come across both these styles
void some_method(int);
and the second style is :
void some_method(int a);
Does one style have any benefit over the other. To me one style just does not have the name of a variable and the name of the variable has to be implemented in the accompanying cpp file.
There is no difference in functionality, but I often use parameter names as a form of documentation, like so:
void verbTheThing(int verbId, int thingId);
When I have nothing valuable to add, I just don't add it:
int max(int, int);
The main concern is consistency. Pick one and stick to it. I prefer the second personally because parameter names can describe functionality and code that's self-documenting is better than the alternative.
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