C:是inline关键字值得吗? [英] C: Is the inline keyword worth it?

查看:105
本文介绍了C:是inline关键字值得吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否值得使用inline关键字或编译器足够聪明,知道什么时候他需要内联函数?

Is it worth it to use the inline keyword or the compiler is smart enough to know when he needs to inline a function ?

推荐答案

的编译器是pretty聪明,有多个指标要弄清楚,如果事情是值得的内联。但有时然而开发商将有关于应用程序将如何运行,并会知道内联的东西,编译器不会自动做知识。不过,我从来没有手动内嵌的东西,除非我有一个做了一些基准测试,发现内联将提高自己的表现。

The compiler is pretty smart, and has multiple metrics to figure out if something is worth inlining. But sometimes however the developer will have knowledge about how the application is going to be run and will know to inline something that the compiler doesn't do automatically. However, I would never inline stuff manually unless I had a done some benchmarks and found that inline would improve my performance.

您可以阅读更多有关 GCC如何使用内联

这篇关于C:是inline关键字值得吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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