-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: allow 'stackalloc' followed by initialization #1112
Comments
Tagging @VSadov @OmarTawfik |
I think Span is similar to var span = {1, 2, 3}; |
@alrz What would be the backing store of |
@orthoxerox It could be a shorthand for |
@alrz I think this might be too confusing. Nothing indicates that you cannot return this value from your method, but you can't. |
Yeah, Span<int> x = { 1 };
Span<int> x = stackalloc [] { 1 };
Span<int> x = stackalloc int[] { 1 };
Span<int> x = stackalloc int[1] { 1 }; With arrays, you can use |
The question of array initializers for stackalloc comes up very often nowdays. It is fairly uncontroversial and a relatively small feature. It has been discussed before with near universal agreement that it should be done at some point I have posted a proposal here #1122 - to make sure it does not fall off the list. |
For example:
The text was updated successfully, but these errors were encountered: