I know that the compiler can decide whether to inline a function or not. Lets say someone defined a function as inline
in a header file and the function body is also in the header file. Also, say the function is long and the compiler decides NOT to actually inline this function.
f1.h:
inline void f1()
{
/* really long function */
}
What now happens to the function when it is included in multiple cpp translation units -- would that not break the one definition rule and cause multiple definitions at linking time? Or does that inline
property remain, even if it's not actually inlined?
foo.cpp:
#include "f1.h"
/* code here */
bar.cpp:
#include "f1.h"
/* code here */