What does 'inline' mean?

Manu turkeyman at gmail.com
Fri Jun 12 01:55:26 UTC 2020


On Fri, Jun 12, 2020 at 11:51 AM Manu <turkeyman at gmail.com> wrote:

> On Fri, Jun 12, 2020 at 8:20 AM Walter Bright via Digitalmars-d <
> digitalmars-d at puremagic.com> wrote:
>
>> On 6/11/2020 8:42 AM, kinke wrote:
>> > My interest in this wasn't triggered by wanting to enforce particular
>> functions
>> > to be emitted into each referencing CU, but by
>> > a) the current emission scheme requiring LTO in order to inline suited
>> little
>> > templated functions when compiling static libs in one go,
>> > b) being able to use linkonce_odr instead of weak_odr linkage for
>> template
>> > stuff, meaning potentially less work for the linker, and potentially
>> quite a bit
>> > less work for the optimizer. Compiling an optimized dub (a single
>> object file)
>> > with LDC using -linkonce-templates reduces the total compile+optimize
>> times by
>> > roughly 25%, simply because LLVM inlines most little template stuff and
>> can then
>> > discard the unused linkonce_odr functions early in the process, without
>> > uselessly optimizing them to death (as it currently cannot discard it,
>> as other
>> > libraries/objects might depend on some template instances as mentioned
>> earlier).
>>
>> A library consists of two parts:
>>
>> 1. the "header" file
>> 2. the binary to link with, which may be absent
>>
>> Take some care in what goes in 1, what goes in 2, and you'll be fine.
>>
>> For example, consider core.checkedint. The functions in it are all
>> templates so
>> that they can be used with -betterC which doesn't link with druntime.
>> It's a
>> classic "header only" library. It works fine.
>>
>
> We're not talking about templates.
>

This is another one of those cases is really bizarre resistance to what
seems like a blindingly obvious thing.
Can you please explain why you feel opposed to this, and why our existing
solution, which is 'weird' by all accounts, and satisfies ZERO of the goals
assigned to inline is preferable?
The existing implementation is inline is a COMPLETELY useless thing. If you
can't see where I'm coming from in this thread, then I suggest we remove it
completely.
It's existence solves zero problems, and does actual damage to D by
existing, because people try it and find that it's broken, and then they're
confused and/or lose a little confidence in D.
I mean that seriously; if you deny there's a problem and refuse to fix
this, then I seriously encourage you to deprecate and remove pragma(inline)
from the language. It's worse than nothing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20200612/5a9b8fc3/attachment.htm>


More information about the Digitalmars-d mailing list