Edit

Share via


inline_depth pragma

Specifies the inline heuristic search depth. Functions at a depth in the call graph greater than the specified value aren't inlined.

Syntax

#pragma inline_depth( [ n ] )

Remarks

This pragma controls the inlining of functions marked inline and __inline, or inlined automatically under the /Ob compiler option. For more information, see /Ob (Inline function expansion).

n can be a value between 0 and 255, where 255 means unlimited depth in the call graph. A value of 0 inhibits inline expansion. When n isn't specified, the default value 254 is used.

The inline_depth pragma controls the number of times a series of function calls can be expanded. For example, assume the inline depth is 4. If A calls B, and B then calls C, all three calls are expanded inline. However, if the closest inline depth expansion is 2, only A and B are expanded, and C remains as a function call.

To use this pragma, you must set the /Ob compiler option to 1 or higher. The depth set using this pragma takes effect at the first function call after the pragma.

The inline depth can be decreased during expansion, but not increased. If the inline depth is 6, and during expansion the preprocessor encounters an inline_depth pragma with a value of 8, the depth remains 6.

The inline_depth pragma has no effect on functions marked with __forceinline.

Note

Recursive functions can be substituted inline to a maximum depth of 16 calls.

See also

Pragma directives and the __pragma and _Pragma keywords
inline_recursion