Sobes.tech
Middle+

Is it possible to make all functions inline at the compiler level?

sobes.tech AI

Answer from AI

No, it is not possible to forcibly make all functions inline at the compiler level. The C++/Kotlin/Java compiler treats the inline keyword as a recommendation, not a mandatory requirement. It may ignore inline for functions that:

  • Are too large.
  • Have recursive calls.
  • Are called through a pointer/reference to a function.
  • Throw exceptions.
  • Are virtual.

The compiler itself determines whether it is beneficial to inline a function based on optimizations and code size. Forcing inlining of everything can lead to an increase in the executable size and a decrease in performance due to worsened locality of reference for instructions.

Is it possible to make all functions inline at the… - sobes.tech