c - 静态内联 vs 内联静态

标签 c static inline c99 function-declaration

我注意到两者都有效,在这里使用内联的正确方法是什么?

static inline int getAreaIndex()

或者
inline static int getAreaIndex()

另外,getAreaIndex 包含一个大循环。有时我只调用一个,有时我通过循环调用它,我应该内联它吗? (它有 10 行高)

最佳答案

What is the correct way to use inline here



两者 static inlineinline static是允许的,它们的意思是一样的。 static inline是首选风格。

should I inline this function



要回答这个问题,您需要以两种方式对您的程序进行基准测试,并找出哪个更快。

关于c - 静态内联 vs 内联静态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61714110/

相关文章:

c - 为什么实现文件中的C结构体定义不可用?

python - 如何只读取前两个数字? python +串口

php - 何时在 PHP 中使用静态修饰符

Java 接口(interface)比较器静态比较

c++ - 内联函数上的 static_assert 给出错误

css - 在 React 组件中使用 css/scss 变量作为内联样式

c - 通过指针的字符串(数组)容量

c - 请求非结构或 union 中的成员 ‘thisWalkno’。 (P线程)

c++ - 从文件初始化静态常量成员

c++ - 如果递归函数定义为内联会发生什么?