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

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jan 9 02:34:37 UTC 2020


On Thu, Jan 09, 2020 at 12:01:39PM +1000, Manu via Digitalmars-d wrote:
> On Thu, Jan 9, 2020 at 10:49 AM H. S. Teoh via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
[...]
> >         auto myFunc() @safe {
> >                 ... // mundane stuff
> >                 () @trusted {
> >                         // dangerous stuff goes here
> >                 }();
> >                 ... // more mundane stuff
> >         }
> >
> > But it's quite the eyesore, I'll admit.
[...]
> Lambdas are usually suggested, but it's a completely unacceptable hack.
>  * additional function call overhead
>  * influences the inliner heuristics unfavourably
>  * may allocate a closure if you're not careful
[...]

Oh? Didn't somebody post a PR to inline these lambdas when they appear
in such contexts?  Was that never merged, or is it only active with
-inline?  Did you check the output asm to see what it actually does?


T

-- 
The irony is that Bill Gates claims to be making a stable operating system and Linus Torvalds claims to be trying to take over the world. -- Anonymous


More information about the Digitalmars-d mailing list