Am 02.04.20 um 13:17 schrieb Stefan Brüns:
So what contradicts keeping exactly *one* definition (in this case in binarystoragebuffer.cpp) with external linkage? How do you want to achieve that without a knowledge where else will be a
On 4/2/20 11:52 AM, Stefan Brüns wrote: header files included for other compilation units? A compiler works on CU-level (without LTO). Because the header file does not have a definition, just the the declaration? The declaration has no "inline", so the compiler can and must assume it has
On Thursday, April 2, 2020 1:00:31 PM CEST Martin Liška wrote: the only definition, and it must emit a global symbol. It is the same as if the definition had no "inline" keyword. The compiler should mostly behave if neither declaration nor definition had the "inline" keyword, just taking it as a hint to inline in the current CU.
No, the compiler can't assume that, because this is a common and legal pattern: // X.h struct X { void f(); }; inline X::f() {} Keep in mind the preprocessor, the compiler conceptually doesn't see whether the definition was in a header or source file.
If the other CUs had a definition, this would be a violation of the ODR. But this is always the case, no matter if inline or not.
No, because inline functions are excepted from ODR. If there is any declaration of a function as inline, it's inline, so an inline declaration "overrides" a preivous non-inline declaration. Kind regards, Aaron -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org