赞助连接

赞助连接

阅 读 文 章

C 的 inline function

[来源:网上转载 (http://bbs.chinaunix.net) | 作者:网友(网络转载) | 时间:2008-06-14 | 浏览:人次 ]



[Copy to clipboard] [ - ]CODE:#include <stdio.h>

inline void test(void)
{



}

int main()
{

   

    return 0;

}
gcc -std=c99 -o inline inline.c   // 為什麼我加入 -std=c99 會出現下面警告訊息, inline 不是C 99 嗎?

inline.c:4: warning: C99 inline functions are not supported; using GNU89
inline.c:4: warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute


謝謝


static inline


参考一下

http://www.greenend.org.uk/rjk/2003/03/inline.html



一下是c99的

  6.7.4 Function specifiers
  Syntax
1        function-specifier:
                 inline
  Constraints
2 Function specifiers shall be used smilieid="44" border="0" alt="" /> The extent to which such suggestions are effective is
  implementation-defined.119)
6 Any function with internal linkage can be an inline function. For a function with external
  linkage, the following restrictions apply: If a function is declared with an inline
  112                                     Language                                      §6.7.4
  WG14/N1124                          Committee Draft — May 6, 2005                    ISO/IEC 9899:TC2
  function specifier, then it shall also be defined in the same translation unit. If all of the
  file scope declarations for a function in a translation unit include the inline function
  specifier without extern, then the definition in that translation unit is an inline
  definition. An inline definition does not provide an external definition for the function,
  and does not forbid an external definition in another translation unit. An inline definition
  provides an alternative to an external definition, which a translator may use to implement
  any call to the function in the same translation unit. It is unspecified whether a call to the
  function uses the inline definition or the external definition.120)
  EXAMPLE The declaration of an inline function with external linkage can result in either an external
7
  definition, or a definition available for use smilieid="44" border="0" alt="" /> By using, for example, an alternative to the usual function call mechanism, such as ‘‘inline
TAG标签 : the inline function an definition to in external

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表
网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.