惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
C
Check Point Blog
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Forbes - Security
Forbes - Security
IT之家
IT之家
L
LINUX DO - 最新话题
N
News and Events Feed by Topic
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
N
News | PayPal Newsroom
The Last Watchdog
The Last Watchdog
V
Visual Studio Blog
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Webroot Blog
Webroot Blog
TaoSecurity Blog
TaoSecurity Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Schneier on Security
Schneier on Security
P
Privacy International News Feed
G
Google Developers Blog
博客园 - 聂微东
博客园 - 叶小钗
M
MIT News - Artificial intelligence
Apple Machine Learning Research
Apple Machine Learning Research
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
WordPress大学
WordPress大学
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Simon Willison's Weblog
Simon Willison's Weblog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
H
Hacker News: Front Page
Martin Fowler
Martin Fowler
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
T
The Exploit Database - CXSecurity.com
S
Security @ Cisco Blogs
博客园_首页
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
人人都是产品经理
人人都是产品经理
Help Net Security
Help Net Security
Google DeepMind News
Google DeepMind News
T
Threatpost

博客园 - loop

brew 出现 git 错误的问题分析 xcode 编译器在各个arch下面默认宏 parallels无法启动之大乌龙-流水账版 关于结对敏捷开发 android openmax hardware decoder 整合记录 mac上parallel与virtualbox无法共存 git submodule 使用 VLC plugin加载代码分析 在parallel中安装archlinux + awesome 小米盒子试用 keepass管理密码 chrome同步书签cpu占用率过高问题解决 git对svn操作 mac上的ssh proxy客户端 --iSSH个人修改版 终于可以在家更新mplayer了 不要一个人吃饭 在archlinux中安装chrome 关于MP4 fileformat中 duration及timescale相关的几个地方 linux ramdom hung up
inline 小结
loop · 2013-04-16 · via 博客园 - loop

欢迎访问我的blog:http://blog.thinkinside.me

参考资料

http://www.cnblogs.com/cnmaizi/archive/2011/01/19/1939686.html

http://www.greenend.org.uk/rjk/tech/inline.html

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

http://en.wikipedia.org/wiki/Inline_function

http://www.parashift.com/c++-faq-lite/inline-functions.html

http://www.cplusplus.com/forum/articles/20600/

C语言:

static inline

     gcc和c99标准的作用都一样。表示该函数具有static的特性(调用的c文件内有效)和inline特性(展开编译,需要的话会有独立汇编代码。无需进出栈操作)

extern inline

      gcc: 强制将函数设置为inline展开,所以这个函数地址是不存在的,不会有独立汇编代码。无法展开时(比如要取得函数地址)会去找外部的函数实现,如果在其他文件中未找到实现,会返回unresolved reference。

     c99: 会有独立的汇编代码。声明或实现有未声明inline,或者有声明了extern。

inline

   如果在a.c中实现了inline func_a() {…},那么:

       gcc: a.c中其他函数调用func_a是inline展开,其他文件b.c, c.c...中调用则是按照普通函数调用的模式,并非展开。func_a会有独立的汇编object

     c99:类似于gcc的extern inline。声明和实现都有inline,但没有extern。可以在本函数内实现一个外部函数的替代实现。不会有独立汇编代码,其他函数无法call到 

gcc

c99

static inline

如果需要会有独立object code

如果需要会有独立object code

inline

有独立object code

没有独立object code

extern inline

没有独立object code

有独立object code

C++:

declaration inline

     在class声明中实现的method默认是inline的

 class Fred {

public:

  void f(int i, char c){

...

}

};

definition inline

    在声明中不需要标明inline,在实现中标明

    如:

 class Fred {

public:

  void f(int i, char c);

};

inline

void Fred::f(int i, char c)

{

  ...

}

Microsoft VC:

       inline的关键字是__forceinline