Escape Analysis on reddit

Steven Schveighoffer schveiguy at yahoo.com
Sat Nov 1 08:23:17 PDT 2008


"ore-sama" wrote
> Walter Bright Wrote:
>
>> http://www.reddit.com/r/programming/comments/7akzd/escape_analysis/
>
> how to mark and verify this?
>
> void foo()
> {
>  void goo()
>  {
>    DoSomeJob();
>  }
>  JobHandle job=ThreadPool.QueueJob(&goo); //goo goes to the global state
>  ...
>  job.WaitForCompletion(); //but it's safe
> }

I think your example would be impossible for the compiler to prove safe, 
even with all the code available, and all dependency graphs available.

This might be a case where you have to force the compiler to accept it.

Walter, if you do implement this feature, will there at least be a way to 
force perceived incorrect code to compile?  Similar to casting away const 
when you know what you are doing.

-Steve 





More information about the Digitalmars-d mailing list