Built-in functions in C ++ - conditions

In what state does an inline function cease to be an inline function and act like any other function?

+5
source share
3 answers

Myth:
inline - This is just a sentence that the compiler may or may not abide by. A good compiler will always do what needs to be done.

True: it
inline usually indicates an implementation that the built-in substitution of the function body at the call point is preferable to the usual function call mechanism. An implementation is not required to perform this built-in lookup at the dial peer; however , even if this substitution is inlineomitted, other rules follow (especially wrt One definition rule) for inline.

inline inline ?

, .

static inline, static, inline , .

static inline . (inline ) ( ), ( inline ),

+7

.

, :

  • , -
  • ( )
+1

.

, . , , .

, . , :

int MyClass::getValue()
{
  return someVariable;
}

, . , :

myInstance->getValue()

myInstance->someVariable

.

+1

All Articles