DIP 1028---Make @safe the Default---Community Review Round 1

Walter Bright newshound2 at digitalmars.com
Wed Jan 15 17:49:07 UTC 2020

On 1/8/2020 9:57 PM, Manu wrote:
>> This is routinely done in Phobos by making a tiny one line anonymous @trusted
>> lambda and immediately calling it. The compiler will inline it.
> Unacceptable and embarrassing.
> The compiler does not inline it (appears to be subject to
> optimisation),

You have to use the -inline switch (for DMD), that's true.

> and LDC/GDC implement different inlining rules where
> the compilers internal heuristics are undesirably perturbed by this
> 'pattern'.

It's a one-expression lambda. Why wouldn't it inline? I use one liner functions 
all the time, expecting them to inline. It's pervasive in D. Of course, I always 
use -inline for release builds.

More information about the Digitalmars-d mailing list