Developer Guide and Reference


inline, noinline, forceinline

Specifies inlining of all calls in a statement. This also describes pragmas forceinline and noinline.


#pragma inline [recursive]
#pragma forceinline [recursive]
#pragma noinline
Indicates that the pragma applies to all of the calls that are called by these calls, recursively, down the call chain.
These are statement-specific inlining pragmas. Each can be placed before a C/C++ statement, and it will then apply to all of the calls within a statement and all calls within statements nested within that statement.
pragma indicates that the calls in question should be inlined whenever the compiler is capable of doing so.
pragma is a hint to the compiler that the user prefers that the calls in question be inlined, but expects the compiler not to inline them if its heuristics determine that the inlining would be overly aggressive and might slow down the compilation of the source code excessively, create too large of an executable, or degrade performance.
pragma indicates that the calls in question should not be inlined.
These statement-specific pragmas take precedence over the corresponding function-specific pragmas.
Example: Using the
recursive pragma
#include <stdio.h> static void fun(float a[100][100], float b[100][100]) {   inti , j;   for (i = 0; i < 100; i++) {     for (j = 0; j < 100; j++) {       a[i][j] = 2 * i;       b[i][j] = 4 * j;     }   } } static void sun(float a[100][100], float b[100][100]) {   int i, j;   for (i = 0; i < 100; i++) {     for (j = 0; j < 100; j++) {       a[i][j] = 2 * i;       b[i][j] = 4 * j;     }     fun(a, b);   } } static float a[100][100]; static float b[100][100]; extern int main() {   int i, j;   for (i = 0; i < 100; i++) {     for (j = 0; j < 100; j++) {       a[i][j] = i + j;       b[i][j] = i - j;     }   }   for (i = 0; i < 99; i++) {     fun(a, b); #pragma forceinline recursive     for (j = 0; j < 99; j++) {       sun(a, b);     }   }   fprintf(stderr, "%d %d\n", a[99][9], b[99][99]); }
forceinline recursive
pragma applies to the call 'sun(a,b)' as well as the call 'fun(a,b)' called inside 'sun(a,b)'.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at