C# stack allocation #9524
Replies: 5 comments 7 replies
-
I think you answered why the .NET runtime doesn't allow it. It's not even an option for C#, regardless of what syntax might make sense. |
Beta Was this translation helpful? Give feedback.
-
How does the compiler do that? The impl of |
Beta Was this translation helpful? Give feedback.
-
So how rust compiler are able to? |
Beta Was this translation helpful? Give feedback.
-
There's nothing to do with the C# compiler. If the .net jit compiler can prove See https://godbolt.org/z/qvP855165 for the example. Although |
Beta Was this translation helpful? Give feedback.
-
I know that escape analysis has been introduced into the run time, but what about aot |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why can't we simply write the following sentence to define an object on the stack
Class a;
a.somemethod();
For sure its not that just simple as for sure, compiler needs to check any ref to a never get out of the scope, etc.....
Beta Was this translation helpful? Give feedback.
All reactions