What does 'inline' mean?

Steven Schveighoffer schveiguy at gmail.com
Wed Jun 10 19:20:55 UTC 2020


On 6/10/20 2:54 PM, kinke wrote:
> On Wednesday, 10 June 2020 at 13:55:40 UTC, Steven Schveighoffer wrote:
>> On 6/9/20 8:20 PM, Stefan Koch wrote:
>>> Yes making the function a function template will do that.
>>> And Manu is fully aware of it.
>>>
>>> It's a nasty hack.
>>> And in certain cases it screws with overload-resolution.
>>
>> It's not exactly the same. If the compiler thinks an imported module 
>> has instantiated it, it will not include it in the object file (unless 
>> you use -allinst).
> 
> Nope, -allinst doesn't make sure all templates are instantiated in each 
> object file. I'll link again to 
> https://github.com/ldc-developers/ldc/pull/3422#issuecomment-625945508.

I can't tell from that discussion what you mean.

My understanding with -allinst is that the compiler is supposed to 
instantiate all templates even if it thinks a dependent library has 
already done it.

But I'm happy to defer to you as an actual developer of the compiler, 
I'm not. I have had experience as a user with the compiler making wrong 
decisions about whether it should emit code for a template instance or not.

In any case, my point is that just making it a template isn't the 
equivalent as has been suggested.

-Steve


More information about the Digitalmars-d mailing list