是“内联”吗?有效的C? [英] Is "inline" valid C?

查看:87
本文介绍了是“内联”吗?有效的C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述






是否存在允许内联的C标准的任何修订版本。关键字

(或类似功能)?我知道它可以在gcc中使用,但是它可能只需要一个gcc功能就可以了。


问候,克里斯


-

Christian Staudenmayer

德国乌尔姆大学
cs****@gmail.com

推荐答案

文章< 41 ****** @ news.uni- ulm.de>,

Christian Staudenmayer< cs **** @ gmail.com>写道:
In article <41******@news.uni-ulm.de>,
Christian Staudenmayer <cs****@gmail.com> wrote:



是否有任何C标准的修订版,允许内联版本。关键字
(或类似功能)?我知道它可能在gcc中,但它可能只是一个gcc功能。

Hi,

is there any revision of the C standard that allows the "inline" keyword
(or a similar feature)? I know it is possible in gcc, but then it might
be a gcc feature only.




它在C99中,并且也被广泛实现为延期。


如果你不使用内联作为一个标识符,你可以使用

声明在

的实现上有效并忽略它只是#defining it to nothing:


#ifndef HAS_INLINE

#define inline / *这里没什么可看的,沿着* /

#endif

dave


-

Dave Vandervies dj ****** @ csclub.uwaterloo.ca

如果您在制作有效积分时出错,您可以指望我们

指出错误。如果您后来声称没有犯下

错误,那么您可能会受到抨击。 --Keith Thompson在comp.lang.c



It''s in C99, and also widely implemented as an extension.

If you don''t use "inline" as an identifier, you can make its use in a
declaration valid-and-ignored on implementations that don''t have it by
simply #defining it to nothing:

#ifndef HAS_INLINE
#define inline /*Nothing to see here, move along*/
#endif
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
If you make an error while making a valid point, you can expect us to
point out the error. If you later claim not to have committed the
error, you can expect to be flamed. --Keith Thompson in comp.lang.c


Dave Vandervies写道:
Dave Vandervies wrote:
在文章< 41 ****** @ news .uni-ulm.de>,
Christian Staudenmayer< cs **** @ gmail.com>写道:
In article <41******@news.uni-ulm.de>,
Christian Staudenmayer <cs****@gmail.com> wrote:


是否有允许内联的C标准的任何修订版本。关键字
(或类似功能)?我知道在gcc中它是可能的,但它可能只是一个gcc功能。
Hi,

is there any revision of the C standard that allows the "inline" keyword
(or a similar feature)? I know it is possible in gcc, but then it might
be a gcc feature only.



它在C99中,并且也作为扩展广泛实现。 br />
如果你不使用内联作为一个标识符,你可以在一个
声明中使用
声明,对那些没有它的实现进行有效和忽略,只需#defining it to nothing:

#ifndef HAS_INLINE
#define inline / *没什么可看的,沿着* /
#endif

dave


It''s in C99, and also widely implemented as an extension.

If you don''t use "inline" as an identifier, you can make its use in a
declaration valid-and-ignored on implementations that don''t have it by
simply #defining it to nothing:

#ifndef HAS_INLINE
#define inline /*Nothing to see here, move along*/
#endif
dave




我认为我对gcc的命令行选项有误解,因为

-ansi产生了关于inline的错误。但显然-ansi意味着

与-std = c89(即C90)相同。


因此,如果我使用-std = c99我可以使用 ;在线"并且仍然确定

编译器会警告我违反标准吗?


问候,克里斯。


-

Christian Staudenmayer

德国乌尔姆大学
cs****@gmail.com


dj******@csclub.uwaterloo.ca (Dave Vandervies)写道:
dj******@csclub.uwaterloo.ca (Dave Vandervies) writes:
文章< 41 ****** @ news.uni -ulm.de>,
Christian Staudenmayer< cs **** @ gmail.com>写道:
In article <41******@news.uni-ulm.de>,
Christian Staudenmayer <cs****@gmail.com> wrote:
是否存在允许内联的C标准的任何修订版本。关键字
(或类似功能)?我知道它可能在gcc中,但它可能只是一个gcc功能。
is there any revision of the C standard that allows the "inline" keyword
(or a similar feature)? I know it is possible in gcc, but then it might
be a gcc feature only.



它在C99中,并且也作为扩展广泛实现。



It''s in C99, and also widely implemented as an extension.




但是,GCC实现的语义,大概是由其他一些编译器实现的语义,与C99指定的语义不同。

-

Ben Pfaff

电子邮件: bl*@cs.stanford.edu

web: http://benpfaff.org


这篇关于是“内联”吗?有效的C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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