Why comment parameter names rather than leave it as it is

前端 未结 6 695
隐瞒了意图╮
隐瞒了意图╮ 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:20

    If that is the beginning of the definition of onPaint() I have seen commented out argument names used to avoid "unreferenced formal parameter" compiler warnings (these warnings will only appear at a high warning level, level -W4 for Microsoft compilers).

提交回复
热议问题