定义中函数标题后的 C 变量声明 [英] C variable declarations after function heading in definition

查看:53
本文介绍了定义中函数标题后的 C 变量声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读一些 FreeBSD 源代码时(参见:radix.h 行 158-173),我发现变量声明跟在定义中的函数标题"之后.

When reading some FreeBSD source code (See: radix.h lines 158-173), I found variable declarations that followed the "function heading" in the definition.

这在 ISO C (C99) 中有效吗?什么时候应该在生产代码中完成而不是仅仅在函数标题"中声明变量?为什么要在这里做?

Is this valid in ISO C (C99)? when should this be done in production code instead of just declaring the variables within the "function heading?" Why is it being done here?

我指的是标题字符串的函数,看起来像这样:int someFunction(int i, int b) {

I refer to the function heading the string that looks like this: int someFunction(int i, int b) {

推荐答案

看起来像 K&R (pre-ANSI) 风格.我不认为它是有效的 C99,但他们使用 C99 吗?乔尔

That looks like K&R (pre-ANSI) style. I don't think it's valid C99, but are they using C99? Joel

这篇关于定义中函数标题后的 C 变量声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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