What does 'inline' mean?
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Mon Jun 8 23:19:55 UTC 2020
On Monday, June 8, 2020 8:09:04 AM MDT Manu via Digitalmars-d wrote:
> On Mon, Jun 8, 2020 at 8:20 PM Walter Bright via Digitalmars-d <
> > C/C++ inline has always been a hint to the compiler, not a command.
>
> It's not a hint at all. It's a mechanical tool; it marks symbols with
> internal linkage, and it also doesn't emit them if it's never referenced.
> The compiler may not choose to ignore that behaviour, it's absolutely
> necessary, and very important.
It is my understanding that in C++, inline is a hint to the compiler with
regards to whether a particular function call is actually inlined. There are
other effects that inline has which aren't just a hint, but the behavior of
actually inlining the function is a hint, not a command.
Of course, in D, it's even weirder, because it's been "give me an error if
the compiler fails to inline it," and I don't know that it even functions as
a hint at that point as opposed to just a way to find out that the compiler
didn't do what you wanted.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list