CR> If you define an inline function outside of a header file,
CR> it must be local to one module.
An inline function that is defined in one translation unit may or may not
have external linkage. An inline function that is defined in *more* than one
translation unit *should* (not "must") have internal linkage, because if it
has external linkage, the One Definition Rule applies, which means that
unless you are careful your program can be ill-formed but no diagnostic need
necessarily occur. This is, to put it mildly, a rather large headache, and
one reason that `extern inline' functions are best off in headers.
Incidentally, the default for inline functions, in the latest draft of the
Standard, is to have external linkage, just like all other functions. So
start labelling your inline functions explicitly `static' now, so that you
get into the habit.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|