what “inline __attribute__((always_inline))” means in the function?

前端 未结 2 1376
心在旅途
心在旅途 2020-12-05 19:26

I have found the following function definition :

static inline __attribute__((always_inline)) int fn(const char *s)
{
  return (!s || (*s == \'\\0\'));
}
         


        
2条回答
  •  情书的邮戳
    2020-12-05 20:07

    It forces the compiler to inline the function even if optimizations are disabled. Check this documentation for more information.

提交回复
热议问题