December 07, 2010
Hello,

Does dmd inline when appropriate (eg single-line func)? or is there a hint keyword? or what else? Eg how to have this inlined:

private bool isPrecomposedHangulSylable (Code code) {
    /** whether code is a precomposed Hangul syllable ;-) */
    return (code >= FIRST_HANGUL_SYLLABLE) && (code <= LAST_HANGUL_SYLLABLE);
}

Thank you,
Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com

December 07, 2010
On 12/07/10 05:05, spir wrote:
> Hello,
> 
> Does dmd inline when appropriate (eg single-line func)? or is there a hint keyword? or what else? Eg how to have this inlined:
> 
> private bool isPrecomposedHangulSylable (Code code) {
>     /** whether code is a precomposed Hangul syllable ;-) */
>     return (code >= FIRST_HANGUL_SYLLABLE) && (code <= LAST_HANGUL_SYLLABLE);
> }
> 
> Thank you,
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ☣
> 
> spir.wikidot.com
> 

DMD performs inlining as it deems appropriate, but only if the '-inline' switch is provided on the command line.  Generally speaking, very simple one-liners like yours will get inlined.

-- Chris N-S