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!
== Example == An <code>inline</code> function can be written in C or C++ like this: <syntaxhighlight lang="c"> inline void swap(int *m, int *n) { int tmp = *m; *m = *n; *n = tmp; } </syntaxhighlight> Then, a statement such as the following: <syntaxhighlight lang="c"> swap(&x, &y); </syntaxhighlight> may be translated into (if the compiler decides to do the inlining, which typically requires optimization to be enabled): <syntaxhighlight lang="c"> int tmp = x; x = y; y = tmp; </syntaxhighlight> When implementing a sorting algorithm doing lots of swaps, this can increase the execution speed.
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)