inline vs __inline vs __inline__ vs __forceinline? [英] inline vs __inline vs __inline__ vs __forceinline?
问题描述
这四个内嵌(关键)字之间有什么区别?
inline
, __ inline
, __ inline __
, __ forceinline
。
<在C ++和C99中
__inline __ 类似于
__ inline
,但是来自另一组编译器。 __ forceinline
是另一个特定于供应商的(主要是MSVC)关键字,它会对 __ inline
hint
在GCC中还有 __ attribute __((always_inline))
铛。
What are the differences between these four inline (key)words?
inline
, __inline
, __inline__
, __forceinline
.
inline
is the keyword, in C++ and C99.
__inline
is a vendor-specific keyword (e.g. MSVC) for inline function in C, since C89 doesn't have it.
__inline__
is similar to __inline
but is from another set of compilers.
__forceinline
is another vendor-specific (mainly MSVC) keyword, which will apply more force to inline the function than the __inline
hint (e.g. inline even if it result in worse code).
There's also __attribute__((always_inline))
in GCC and clang.
这篇关于inline vs __inline vs __inline__ vs __forceinline?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!