在MFC或VC里面一个函数定义为abc()和abc(void)有区别吗?

解决方案 »

  1.   

    定义的时候不怕,没有区别的.但调用的时候写上void会出错. 例如 void main()
    {
        abc(void); //这样写会出错
    }
      

  2.   

    我们可以在《ISO/IEC 9899》的C语言规范找到下面两段关于函数声明的描述10.The special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters14.An identifier list declares only the identifiers of the parameters of the function. An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters. The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied.124)上面两段话的意思就是:func(void)是没有参数,而func()等于func(…)等于参数类型未知