C# stack allocation #9524
Replies: 6 comments 8 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.
-
i inderstand, but we can do this way
but if we out of this scope, we lose data and it's main problem
then
but problem in next, we need call
at hand somewere if u solve or find how use this more simplest use some c# suggar, it will be great |
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