May 31, 2023 pragma inline and public imported functions from another module | ||||
---|---|---|---|---|
| ||||
If I declare something as pragma( inline, true ) and it is declared public and then imported into another module will it then inline into the call site in GDC / LDC ? (Like a C function (or macro) whose body is given in whole in a .h file and force-inlined, not a call resolved by the linker.) So that’s my question: does the import mechanism defeat enforced inlining in GDC / LDC? Not the absolute end of the world if it doesn’t but then users will just absolutely have to cut and past the inline-critical code into their calling module. And it will be incredibly short code, anyway in such a case, otherwise a call to a single copy of a somewhat longer routine might well be better if called from several places because of code-caching hotness. I can’t test that yet myself as I don’t have a suitable test bed due to poor health - long story. I’ve been using godbolt.org Compiler Explorer to examine code generation quality. |
Copyright © 1999-2021 by the D Language Foundation