Chinaunix首页 | 论坛 | 博客
  • 博客访问: 629338
  • 博文数量: 105
  • 博客积分: 5389
  • 博客等级: 准将
  • 技术积分: 1290
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-29 11:13
文章分类

全部博文(105)

文章存档

2010年(23)

2009年(20)

2008年(62)

分类: C/C++

2008-12-31 10:01:14

昨天阅了一段mips汇编代码,发现我的inline没如愿地被展开.一顿纳闷之后跟同事讨论,说inline是建议性的关键字,为确认准确性,在《C Reference Manual》中找到了答案,摘相关要点如下:

The inline designation is only a hint to the translator, suggesting that calls to the inline function should be as fast as possible. The name comes from a compiler optimization called inline expression.

There are three important principles for inline expansion:

1.  Visible definition. In C99, if a function is declared inline, then the function’s definition must be visible in that translation unit.

2.  Free choice. Translators are never obligated to perform inline expansion. A C program must never depend on whether a call is expanded.

3.  Same meaning. Inline expansion is only an optimization; it does no change the meaning of the program.

1  基础不扎实

2  有疑问时,多交流,并查阅权威进行确认


阅读(1060) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~