为什么FUNC()之间被放置声明{}? [英] Why are declarations put between func() and {}?

查看:125
本文介绍了为什么FUNC()之间被放置声明{}?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SED源只见常

  FUNC(...)
INT B:
焦炭℃;{
...
}

为什么把变量存在?它是否在改变范围有多大?

喜欢这里:的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,反,ICASE,DFA)
 51 re_string_t * PSTR;
 52为const char * str中;
 53 INT LEN,init_len,ICASE;
 54 RE_TRANSLATE_TYPE跨;
 55常量re_dfa_t * DFA;
 56 {
 57 reg_err code_T RET;
 58 INT init_buf_len;
 59


解决方案

这只是旧样式,与类型参数函数声明的整个概念是没有出台,直到后来pre-ANSI C的!

In sed source I saw often

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

{
...
}

Why put variables there? Does it change the scope?

Like here: 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 

解决方案

That's just old style, pre-ANSI C. The whole notion of function declarations with type parameters wasn't introduced until later!

这篇关于为什么FUNC()之间被放置声明{}?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆