Help, what is the code mean?

Net netorib94 at gmail.com
Tue Apr 28 20:48:57 UTC 2020


On Monday, 27 April 2020 at 13:36:25 UTC, Adam D. Ruppe wrote:
> 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.

() { ... } ();

Is there a name of this kind of function in D? unnamed? anonymous?


More information about the Digitalmars-d-learn mailing list