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

问题描述






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

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


问候,克里斯


-

Christian Staudenmayer

德国乌尔姆大学

推荐答案




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


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

声明在

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


#ifndef HAS_INLINE

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

#endif

dave


-

Dave Vandervies

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

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

错误,那么您可能会受到抨击。 --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




它在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

德国乌尔姆大学




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



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




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

-

Ben Pfaff

电子邮件:

web:


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

05-27 18:11
查看更多