On the cppreference page for the inline specifier, it says,
The
inlinespecifier, when used in a function's decl-specifier-seq, declares the function to be an inline function.
An inline function has the following properties:
There may be more than one definition of an inline function in the program as long as each definition appears in a different translation unit and all definitions are identical.
...
Then, a bit down, it says,
The original intent of the
inlinekeyword was to serve as an indicator to the optimizer that inline substitution of a function is preferred over function call. ...
Apart from this line, there is no reference to this use of inline. Is the latter meaning of inline still valid in the C++ standards? Or is the latter form deprecated over the former?
If the latter form is still valid, is it worth using it in modern compilers? I have heard that, even though it is the compiler that makes the decision about inlining, using the inline keyword pushes it a bit. Is this true? Should I use the inline keyword in my program for this case?
inlineis still valid and essential. The original intend is minor.inlineis irrelevant. It was just a suggestion to the compiler. The compiler can do inlining with or without theinlinekeyword. It only affects how the function is linked.