Sometimes I see code like this:
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
Why comment parameter names rather than leave it as it is?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One reason I see for doing this is that you explicitly want to tell other programmers not to use the parameters, but leave them in comments for a description of their intent. I know this doesn’t make sense now, but read on.
I’ll use a different example:
Say you want this for a specific case where you want
B::foo()to do some extra stuff, and then callA::foo()with the parameter0. You have to keep the same function signature, so polymorphism works, but, insideB::foo(), you’re not actually using the parameter. Nor do you want to use it in the future. It’s basically a statement of intent, saying “the logic of this method should not depend on someProperty”.With the parameter name commented out, you can’t really use it (unless you get down to some hacking). But the commented name tells you something about the parameter you pass to
A::foo()– its ‘someProperty’ fromA.Now, I don’t agree with the syntax, but this can be a possible explanation.