The semantics of inline
are one of the areas where C and C++ are pretty different. This post is about the C++ semantics, but the history is interesting, so here's a short summary of it.
The meaning of "inline" is intuitively easy to understand: It gives the compiler a hint that it'd be nice if a function could be inlined. It gets a bit complicated because of two issues:
- If the function ends up not being inlined, where should the definition of the function be emitted?
- If the inline function contains a static local variable, should that be inlined? Should there be several copies of the static local, or just one?