Using void in functions without parameter?

前端 未结 5 994
说谎
说谎 2021-02-19 07:44

In C++ using void in a function with no parameter, for example:

class WinMessage
{
public:
    BOOL Translate(void);
};

is redunda

5条回答
  •  庸人自扰
    2021-02-19 08:48

    I see absolutely no reason for this. IDEs will just complete the function call with an empty argument list, and 4 characters less.

    Personally I believe this is making the already verbose C++ even more verbose. There's no version of the language I'm aware of that requires the use of void here.

提交回复
热议问题