[Issue 15110] pragma(inline) rarely works how I want it to
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Oct 3 16:55:25 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15110
--- Comment #6 from Manu <turkeyman at gmail.com> ---
There are cases where it should be valid to fail inlining, but shouldn't be an
error.
For instance, if I take the address of the function, that kinda implies it
needs to emit an instance of the function... I shouldn't need to duplicate the
function just because I take a function pointer in some situation.
Another problem is that it's difficult to make all compilers inline with
exactly the same behaviour, and what might work fine in one doesn't work in the
other. I don't believe it's reasonable for this to emit a compile error when
behaviour is different between compilers. You can't reliably build code
anymore.
It should just be a warning. The user needs to know when it doesn't inline, and
they can then take appropriate action, but it shouldn't stop the program from
compiling. That's highly annoying, it may create mutual-exclusions with other
configurations where it works fine. It may very well be a niche configuration
where it doesn't work (probably, since inhibitors would be addressed in the
main configuration). There's no value in making it an error, it's only
annoying, and results in code that's almost certainly brittle, since you have
no idea whether your code will compile without errors unless you test every
possible configuration.
__forceinline/__attribute__((always_inline)). The behaviour is the same; it's a
warning when inlining fails, and it would be extremely inconvenient (to the
point of the feature being virtually useless) if it didn't behave this way.
--
More information about the Digitalmars-d-bugs
mailing list