coder.inline
Control inlining of current function in generated code
Syntax
Description
coder.inline(
controls the inlining of
the current function in the generated C/C++ code, as specified by
option
)option
.
coder.inline("always")
instructs the code generator to replace a function call with the contents (body) of the called function in the generated code.coder.inline("never")
prevents inlining of the current function in the generated code.
Inlining eliminates the overhead of a function call and can create opportunities for
further optimization of the generated code, but can generate larger, more complex code.
Conversely, preventing inlining can simplify the mapping between the MATLAB® code and the generated code. By default, the code generator uses internal
heuristics to determine whether to inline the current function. Usually, these heuristics
produce highly optimized code. Use the coder.inline
optimization
directive explicitly in your MATLAB functions only when you need to fine-tune these optimizations.