If I create an inline function, does it change its connection with the internal connection?
No, including it in a string does not change its binding.
Why do I need to define an inline function in each file so that it can be called?
Because language requires it. C ++ 11 7.1.2 / 4 says: "The built-in function must be defined in each translation unit in which it is used by odr, and must have exactly the same definition in each case.
Am I getting an intercom?
No, it still has an external connection: the pointer to the function will have the same value in any translation unit, and any static objects declared inside the function will be the same object in any translation unit.
What if i use static inline ?
This will give an internal connection due to static . This means that definitions in separate translation units will create separate functions with different addresses and different copies of any static objects.
source share