Forcing inline functions (again) - groan
Stefan Koch
uplink.coder at googlemail.com
Wed Jul 15 14:14:06 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?
>
> 2. Can I declare a function in one module and have it _inlined_
> in another module at the call site?
>
> I’m looking to write functions that expand to approx one or
> even zero machine instructions and having the overhead of a
> function call would be disastrous; in some cases would make it
> pointless having the function due to the slowdown.
pragma inline will work for dmd.
and it used to fail if it couldn't inline.
Now it just generates a warning.
So with -w it will still fail.
Afaik other compilers cannot warn if the in-lining fails but I
might be wrong.
And ldc/gdc should be able to inline most code which makes sense
to inline.
More information about the Digitalmars-d-learn
mailing list