我们可以在c中使用内联函数吗? [英] Can we have inline functions in c?

查看:80
本文介绍了我们可以在c中使用内联函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我们可以在C中使用内联函数,或者这个功能来自C ++。

ANSI对内联函数的使用有什么看法?

gcc是否支持它作为C或C ++的一个功能?


谢谢!

Prafull Soni

Hi,

Can we have inline function in C or this feature is from C++.
What does ANSI say about the use of inline functions?
Do gcc support it as a feature of C or C++?

Thanks!
Prafull Soni

推荐答案



Prafull Soni写道:

Prafull Soni wrote:

我们可以在C中使用内联函数或者此功能是来自C ++。
ANSI对内联函数的使用有何看法?


C99有内联功能,早期版本的标准C

不要。许多C编译器支持某种形式的内联

函数作为扩展。不知道C ++ - 请求大家获得专家意见。

gcc是否支持它作为C或C ++的一个特性?

Can we have inline function in C or this feature is from C++.
What does ANSI say about the use of inline functions?
C99 has inline functions, earlier versions of Standard C
don''t. Many C compilers support some form of inline
functions as extensions. Don''t know about C++ - ask down
the hall for expert opinion.
Do gcc support it as a feature of C or C++?




以C99-ish模式的标准方式,作为其他C模式的扩展,不知道C ++。请向下询问其他

大厅。



In a Standard way in C99-ish mode, as an extension in
other C modes, don''t know about C++. Ask down the other
hall for details.


Prafull Soni写道:
Prafull Soni wrote:

我们可以在C中使用内联函数吗。


是。

或者此功能来自C ++。


它在C ++中有点不同。

ANSI对内联函数的使用有什么看法?
gcc是否支持它C或C ++的功能?

Can we have inline function in C.
Yes.
Or this feature is from C++.
It''s a little different in C++.
What does ANSI say about the use of inline functions?
Do gcc support it as a feature of C or C++?




看看

GCC 4.0中C99功能的状态

< a rel =nofollowhref =http://gcc.gnu.org/gcc-4.0/c99status.html\"target =_ blank> http://gcc.gnu.org/gcc-4.0/c99status.html


E. Robert Tisdale写道:
E. Robert Tisdale wrote:
Prafull Soni写道:
Prafull Soni wrote:

我们可以在C中使用内联函数。

Can we have inline function in C.



是的。



Yes.




Tisdale,我想你应该停止提供这么短的是。或不

答案,除非它是黑/白类型的情况。你是用

做的吗?我最近在你的几个帖子中看到了它,并且它非常有点误导。


C99确实有内联函数但是C89没有'' T。众所周知,编译器的采用率很低,所以明确的答案是不可能的 - 这取决于具体的实现。为了便携性,我不会指望内联代码(事实上,我的桌面编译器

不支持它)。


Tisdale,以是或否停止。请回答。



Tisdale, I think you should stop giving such short "yes" or "no"
answers unless it''s a black/white type situation. Do you do this on
purpose? I''ve seen it in a couple of your posts lately, and it''s very
misleading.

C99 does have inline functions but C89 doesn''t. As we all know, C99
adoption by compilers has been lacklustre, so a clear cut answer is
impossible- it depends on the specific implementation. For portability
sake, I wouldn''t count on inline code (in fact, my desktop compiler
doesn''t support it).

Tisdale, stop with the "YES", or "NO" answers please.


这篇关于我们可以在c中使用内联函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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