我注意到两者都有效,在这里使用内联的正确方法是什么?
static inline int getAreaIndex()
或者
inline static int getAreaIndex()
另外,getAreaIndex 包含一个大循环。有时我只调用一个,有时我通过循环调用它,我应该内联它吗? (它有 10 行高)
最佳答案
What is the correct way to use inline here
两者
static inline
和 inline static
是允许的,它们的意思是一样的。 static inline
是首选风格。should I inline this function
要回答这个问题,您需要以两种方式对您的程序进行基准测试,并找出哪个更快。
关于c - 静态内联 vs 内联静态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61714110/