Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Inline function
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Standard support == [[C++]] and [[C99]], but not its predecessors [[K&R C]] and [[C89 (C version)|C89]], have support for <code>inline</code> functions, though with different semantics. In both cases, <code>inline</code> does not force inlining; the compiler is free to choose not to inline the function at all, or only in some cases. Different compilers vary in how complex a function they can manage to inline. Mainstream C++ compilers like [[Visual C Plus Plus|Microsoft Visual C++]] and [[GNU Compiler Collection|GCC]] support an option that lets the compilers automatically inline any suitable function, even those not marked as <code>inline</code> functions. However, simply omitting the <code>inline</code> keyword to let the compiler make all inlining decisions is not possible, since the linker will then complain about duplicate definitions in different translation units. This is because <code>inline</code> not only gives the compiler a hint that the function should be inlined, it also has an effect on whether the compiler will generate a callable out-of-line copy of the function (see [[#Storage classes of inline functions|storage classes of inline functions]]).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)