Help, what is the code mean?

Adam D. Ruppe destructionator at gmail.com
Mon Apr 27 13:36:25 UTC 2020


On Monday, 27 April 2020 at 13:29:08 UTC, lilijreey wrote:
> Hi:
>    In dlang core.thread.osthread has below code, the 654 line 
> code i can understand why write () first, and {m_fn = fn;}()  
> do what?

The stdlib uses that pattern from time to time to indicate an 
unsafe block in an otherwise safe function.

Specifically it is a little trusted inline function being 
immediately called.

It is something that should be avoided whenever you can.


More information about the Digitalmars-d-learn mailing list