What does 'inline' mean?

Manu turkeyman at gmail.com
Sat Jun 13 03:56:31 UTC 2020


On Sat, Jun 13, 2020 at 1:25 PM Andrei Alexandrescu via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 6/12/20 8:52 PM, Manu wrote:
> > Except in the case I described as case #3, in which it would be useful
> > to have SOME WAY, to 'force inline' and receive an error if it failed.
>
> I recall a couple of compilers (TopSpeed, does anyone remember?) had
> such a feature. The warnings listing the arbitrary functions that failed
> whatever heuristics was utterly useless. No C++ compiler implements it
> today, and I don't think any should.
>

I feel like I clearly agreed here too; I gave 3 cases which are distinct
use cases. C++ implements #1 and #2, and uses the nomenclature `inline` for
those cases.
What you're talking about here is case #3, which C++ doesn't support, and I
agree C++ shouldn't try and jam this idea into `inline` because that has a
confused history, and a fairly well defined present.
That doesn't mean that it's not a useful tool though, and one that I've
wanted lots of times... but as I've made clear, I see this as a distinct
use case, and should be explicit and distinct.

This #3 use case is what `pragma(inline)` is closest to today. We almost
have the #3 thing that C++ doesn't have, and we have no way to express the
#1-2 things that C++ does have.
If it's the case that `pragma(inline)` is designed to model #3, then we're
still out in the dark with #1 and #2, which are the overwhelmingly more
common use cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20200613/30149686/attachment.htm>


More information about the Digitalmars-d mailing list