本文介绍了如何将一个K&安培; R函数声明为自动为ANSI函数声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
// K&R syntax
int foo(a, p)
int a;
char *p;
{
return 0;
}
// ANSI syntax
int foo(int a, char *p)
{
return 0;
}
如你所见,在K&放大器; R风格,类型的变量在新的线路,而不是在大括号声明。如何将一个K&安培; R函数声明为自动为ANSI函数声明?有谁知道这样在Linux下一个易于使用的工具?
As you see, in K&R style, the types of variables are declared in new lines instead of in the braces. How to convert a K&R function declaration to an ANSI function declaration automatically? Does anybody know such an easy-to-use tool in Linux?
推荐答案
您可以使用或protoize( GCC的一部分)产生的函数原型或转换旧样式(K&安培;功能R),以ANSI格式
You can use cproto or protoize (part of GCC) to generate function prototypes or convert old style (K&R) functions to ANSI format.
这篇关于如何将一个K&安培; R函数声明为自动为ANSI函数声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!