Chris Vine <chris@cvine--nospam--.
freeserve.co.uk> writes:
> In C, inline functions have internal linkage by default, [...].
I believe this is not exactly right. As I read the C standard, a
function definition that has 'inline' but does not have 'extern'
still has external linkage, but does not provide an external
definition. Any call to said function might call the inline one
or it might call the externally defined one. (Who thought _that_
rule up? Sounds like a recipe for disaster.) So inline in C is
sort of like internal linkage, and sort of not.
> In C++ they have external linkage by default, [...].
AFAICT C++ is the same as C as far as linkage is concerned (ie,
for inline functions), but is more strict about how inline
functions may be defined in other translation units. Also, C++
allows more latitude for use of 'static' variable definitions
in inline functions.
Disclaimer: all of the foregoing is right to the best of my
understanding, but especially in the case of C++ there may be
something I missed or overlooked.