What does 'inline' mean?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jun 10 00:02:09 UTC 2020


On Tue, Jun 09, 2020 at 04:48:17PM -0700, Walter Bright via Digitalmars-d wrote:
> On 6/9/2020 7:21 AM, Manu wrote:
[...]
> > >   Why? What problem are you solving?
> > 
> > 
> > Literally inline function calling. No-link libs are a really common and
> > extremely useful thing.
> 
> At last! You say why! We have that in D with template functions. You
> get N instantiations. But they all have COMDAT linkage, which means
> only 1 winds up in the executable instead of N.
[...]

Yeah, I was about to say, judging from what Manu has written several
times in this thread, his concept of 'inline' bears striking resemblance
to a template function:

- The template function is not instantiated in its defining module
  (unless something else instantiates it there);

- A template function is instantiated in the invoking module, just like
  how Manu described his 'inline' functions;

- A template function is more likely to be actually inlined (recently
  I've been adding () to some of my functions in order to prod the
  compiler to inline them).  Manu has even stated that whether or not
  the 'inline' function is actually inlined isn't even that important
  anymore; given that, I'd say template functions are what he's looking
  for all this time!


T

-- 
Why ask rhetorical questions? -- JC


More information about the Digitalmars-d mailing list