You copied the Doc URL to your clipboard.

__attribute__((always_inline)) function attribute

This function attribute indicates that a function must be inlined.

The compiler attempts to inline the function, regardless of the characteristics of the function.

In some circumstances, the compiler might choose to ignore __attribute__((always_inline)), and not inline the function. For example:

  • A recursive function is never inlined into itself.
  • Functions that use alloca() might not be inlined.

Example

static int max(int x, int y) __attribute__((always_inline));
static int max(int x, int y)
{
    return x > y ? x : y; // always inline if possible
}
Was this page helpful? Yes No