Using Inline Function Expansion
2-31
C Compiler Description
2.6.3.1 Declaring a Function as Inline Within a Module
By declaring a function as inline within a module (with the inline keyword), you
can specify that the function is inlined within that module. A global symbol for
the function is created (code is generated), but the function is inlined only with-
in the module where it is declared as inline. The global symbol can be called
by other modules if they do not contain a static inline declaration for the func-
tion.
Functions declared as inline are expanded when the optimizer is invoked.
Using the
−
x2 option automatically invokes the optimizer at the default level
(
−
o2).
Use this syntax to define a function as inline within a module:
inline
return-type function-name
(
parameter declarations
)
{
function
}
2.6.3.2 Declaring a Function as Static Inline
Declaring a function as static inline in a header file specifies that the function
is inlined in any module that includes the header. This names the function and
specifies to expand the function inline, but no code is generated for the func-
tion declaration itself. A function declared in this way can be placed in header
files and included by all source modules of the program.
Use this syntax to declare a function as static inline:
static
inline
return-type function-name
(
parameter declarations
)
{
function
}
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...