What does 'inline' mean?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jun 13 03:31:36 UTC 2020


On 6/12/20 9:13 PM, Manu wrote:
> On Sat, Jun 13, 2020 at 10:20 AM Andrei Alexandrescu via Digitalmars-d 
> <digitalmars-d at puremagic.com <mailto:digitalmars-d at puremagic.com>> wrote:
> 
>     On 6/12/20 2:08 PM, Johan wrote:
>      > On Friday, 12 June 2020 at 13:22:35 UTC, Andrei Alexandrescu wrote:
>      >> On 6/8/20 2:14 AM, Manu wrote:
>      >>> In C/C++, inline says that a function will be emit to the
>     binary only
>      >>> when it is called, and the function is marked with internal
>     linkage
>      >>> (it is not visible to the linker from the symbol table)
>      >>
>      >> By my recollection this is not the case for C++, at all.
>      >>
>      >> * "inline" does NOT change a function's linkage in C++. You may
>     have
>      >> inline functions with internal linkage (static inline) or (default)
>      >> external linkage. This is important because e.g. defining a static
>      >> variable in an extern inline function will have the same address in
>      >> all calls to the function.
>      >
>      > I believe Manu tried to explain that `inline` in C++ really only
>     affects
>      > how the linker must treat the symbol, and it is best to remember
>     that it
>      > does nothing at all concerning "inlining" (putting function body
>     inside
>      > another).
> 
>     Thank you. That's not at all what he wrote. AT ALL. It's what I wrote.
> 
>     I'm emphasizing this because it has been a recurring problem: a
>     legitimate problem with an explanation lost in translation.
> 
> 
> You're joking right?

Well, again I tried to get communication going and again I failed. So... 
again I will bow out, with apologies.


More information about the Digitalmars-d mailing list