Difference between __always_inline and inline

社会主义新天地 提交于 2019-12-05 08:31:14

Always inline function attribute indicates that a function must be inlined. The compiler attempts to inline the function, regardless of the characteristics of the function.

However with inline attributes the compiler does not inline a function if doing so causes problems. For example, a recursive function is inlined into itself only once.

__forceinline is equivalent to __always_inline.

This article gives some useful information: https://www.kernel.org/doc/local/inline.html

"In Linux, the keyword "__always_inline" forces a function to be inlined, and "noinline" prevents a function from being inlined. We don't use the "inline" keyword because it's broken."

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!