#pragma inline (C only) / noinline

Category

Optimization and tuning

Purpose

Specifies that a C function is to be inlined, or that a C or C++ function is not to be inlined.

Syntax

C only.
Read syntax diagramSkip visual syntax diagram#pragma inlinenoinline (identifier)
C only.
C++ only.
Read syntax diagramSkip visual syntax diagram#pragma noinline (identifier)
C++ only.

Defaults

The default is noinline.

Parameters

inline
Inlines the named function on every call, provided you have specified the INLINE or the OPT compiler options (otherwise it has no effect). The function is inlined in both selective (NOAUTO) and automatic (AUTO) mode.
noinline

Prevents the named function from being inlined on any call, disabling any effects of the INLINE or OPT compiler options (the pragma has no effect in selective (NOAUTO) mode). It also takes precedence over the C/C++ keyword inline.

identifier
The name of a function to be included or excluded for inlining.

Usage

C only. The directive must be at file scope. C only.

C++ only. The directive can be placed anywhere. C++ only.

IPA effects

If you use either the #pragma inline or the #pragma noinline directive in your source, you can later override them with an appropriate IPA link control file directive during the IPA link step. The compiler uses the IPA link control file directive in the following cases:
  • If you specify both the #pragma noinline directive and the IPA link control file inline directive for a function.
  • If you specify both the #pragma inline directive and the IPA link control file noinline directive for a function.

Related information