The way I think of inline
in C++ is for linkage/scoping. I put it in the same basket with extern
and static
for global objects.
Ty
The main difference is what happens with any static locals in the function -- if the function is static
then each compilation unit will have its own copy of the static locals distinct from any other compilation unit. If the function is inline
, there will only be one (set of) static local(s) shared by all compilation units.