为什么声明放在func()和{}之间?

我经常看到sed来源

func(...) int b; char c; { ... } 

为什么要把变量放在那 它会改变范围吗?

像这里: http : //www.mirrors.docunext.com/lxr/http/source/src/bin/sed/lib/regex_internal.c?v = haiku

 re_string_allocate (pstr, str, len, init_len, trans, icase, dfa) 51 re_string_t *pstr; 52 const char *str; 53 int len, init_len, icase; 54 RE_TRANSLATE_TYPE trans; 55 const re_dfa_t *dfa; 56 { 57 reg_errcode_t ret; 58 int init_buf_len; 59 

这只是旧样式,在ANSI C之前。具有类型参数的函数声明的整个概念直到后来才被引入!

这是K&R(旧)风格,它有效,但..

这只是在C中声明参数的旧(K&R)方式。

 /* Old way of declaring parameters*/ void myFunc(a, b) int a; int b; { ... } 

除非你需要在一个非常古老的编译器上编译代码,否则没有人会这样做,所以要么sed是用旧的编译器编写的,要么代码真的很旧。