When declaring a function, do you put the variable name ?
Code:
void somefunction(int &, double, int); or void somefunction(int &a, double x, int b);
Printable View
When declaring a function, do you put the variable name ?
Code:
void somefunction(int &, double, int); or void somefunction(int &a, double x, int b);
I do, because then I can better see for what the parameters are without having to look in the sources. So in your case I would use non of your, but... or something like that.Code:
void somefunction(int ¤tSpeed, double acceleration, int distanceInMeters);
I prefer the name too, and another argument for that is the auto-complete (with tool-tips) that many IDE's have, offers a big advantage for you or others when you use that function, the tool tips have meaning not just type.
See attached picture... Attachment 5023
I use Visual Studio, so it makes it a lot easier if you do use the variable name. That way you can just fill in the class declaration in the .h file and empty methods are created automatically in the .cpp file. If I'm not using VS, then I typically copy and paste, so having the names helps there also.
Like other people have said, it also helps with parameter completion.
Thanks for sharing your opinions guys. Always nice to see how other people work. :)