Why comment parameter names rather than leave it as it is

前端 未结 6 673
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 10:03

Sometimes I see code like this:

LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)

Why comment pa

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 10:15

    If the called function (OnPaint in your example) do not use the arguments, the coder can avoid warning messages about unused arguments when compiling by not providing argument names.

提交回复
热议问题