Warning - “Old Style Function Definition"

来源:互联网 发布:linux管道符号 编辑:程序博客网 时间:2024/05/22 11:46

刚用PSoC Designer5.0写Timer16_1_ISR中断服务函数,出现warning,按之前4.3的版本是没有警告的,google了下,找到资料解决。

Question: When I compile a project with new version of PSoC Designer, I get warning “Old Style Function Definition”. But earlier, this project used to build without any warning. Why is this warning generated and how do I remove this warning?

Response: In old function definitions, if there is no argument needed to be passed to function, then argument list could be left blank. For example, earlier ‘main’ function could be defined as:

void main()
{
}
But now compiler generates a warning, “Old Style Function Definition for ‘main’”. Though this warning can be safely ignored, if you would like to remove this warning, write definition as below:
void main(void)
{
}

所以在新的编译器编译的时候,即时没有传递参数,也需要把void补上。