HELPLIB.HLB  —  CC  Language topics, Storage Class Modifiers, inline
  Similar to the __inline storage-class modifier, the inline
  storage-class modifier can be used as a declaration specifier in
  the declaration of a function.  This modifier is supported in
  relaxed ANSI C mode (/STANDARD=RELAXED) or if the
  /ACCEPT=C99_KEYWORDS or /ACCEPT=GCCINLINE qualifier is specified.

  With static functions, inline has the same effect as applying
  __inline or #pragma inline to the function.

  However, when inline is applied to a function with external
  linkage, besides allowing calls within that translation unit to be
  inlined, the inline semantics provide additional rules that also
  allow calls to the function to be inlined in other translation
  units or for the function to be called as an external function, at
  the compiler's discretion:

   o  If the inline keyword is used on a function declaration with
      external linkage, then the function must also be defined in the
      same translation unit.

   o  If all of the file scope declarations of the function use the
      inline keyword but do not use the extern keyword, then the
      definition in that translation unit is called an inline
      definition, and no externally-callable definition is produced
      by that compilation unit.

      Otherwise, the compilation unit does produce an
      externally-callable definition.

   o  An inline definition must not contain a definition of a
      modifiable object with static storage duration, and it must not
      refer to an identifier with internal linkage.  These
      restrictions do not apply to the externally-callable
      definition.

   o  As usual, at most one compilation unit in an entire program can
      supply an externally-callable definition of a given function.

   o  Any call to a function with external linkage may be translated
      as a call to an external function, regardless of the presence
      of the inline qualifier.  It follows from this and the previous
      point that any function with external linkage that is called
      must have exactly one externally-callable definition among all
      the compilation units of an entire program.

   o  The address of an inline function with external linkage is
      always computed as the address of the unique
      externally-callable definition, never the address of an inline
      definition.

   o  A call to inline function made through a pointer to the
      externally-callable definition may still be inlined or
      translated as a call to an inline definition, if the compiler
      can determine the name of the function whose address was stored
      in the pointer.
Close Help