inline vs __inline vs __inline__ vs __forceinline? [英] inline vs __inline vs __inline__ vs __forceinline?

查看:150
本文介绍了inline vs __inline vs __inline__ vs __forceinline?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这四个内嵌(关键)字之间有什么区别?



inline __ inline __ inline __ __ forceinline


<在C ++和C99中



__ inline 是供应商特定的关键字(例如

__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屋!

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