Forcing inline functions (again) - groan

kinke kinke at gmx.net
Wed Jul 15 14:22:21 UTC 2020


On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote:
> I recently noticed
>     pragma(inline, true)
> which looks extremely useful. A couple of questions :
>
> 1. Is this cross-compiler compatible?

Works for LDC and DMD, not sure about GDC, but if it doesn't 
support it, it's definitely on Iain's list.

> 2. Can I declare a function in one module and have it _inlined_ 
> in another module at the call site?

For LDC, this works in all cases (i.e., also if compiling 
multiple object files in a single cmdline) since v1.22.

While you cannot force LLVM to actually inline, I haven't come 
across a case yet where it doesn't.


More information about the Digitalmars-d-learn mailing list