avoid extra variable during void pointer cast

Marco Leise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 17 11:54:58 PDT 2017


Am Mon, 15 May 2017 19:30:00 +0000
schrieb Bauss <jj_1337 at live.dk>:

> pragma(inline, true); doesn't actually do what you think it does. 
> In lining is always done whenever possible and that only tells 
> the compiler to spit out an error if it can't inline it.
 
A compiler doesn't simply inline whenever it can. A big
function that's called often would lead to massive code
duplication in that case. What I meant pragma(inline, true) to
do is overrule this cost calculation. Since the OP asked for no
extra function calls, the error on failure to inline seemed
appropriate. Cross-module inlining may fail for example on
some compiler(s) or with separate compilation.

-- 
Marco



More information about the Digitalmars-d-learn mailing list