Skip to content
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

Use Span<T> with fixed fields #33272

Closed
AArnott opened this issue Feb 9, 2019 · 1 comment
Closed

Use Span<T> with fixed fields #33272

AArnott opened this issue Feb 9, 2019 · 1 comment

Comments

@AArnott
Copy link
Contributor

AArnott commented Feb 9, 2019

C# structs can have inline arrays like this:

unsafe struct Some
{
   private fixed byte something[4];
}

But then something is typed as byte*. With Span<T> we should have a safe alternative. Something like:

ref struct Some
{
    private fixed Span<byte> something[4];
}

This removes the unsafe keyword and lets us use Span<T> which embeds the length, making it safer.

@AArnott
Copy link
Contributor Author

AArnott commented Feb 9, 2019

This issue was moved to dotnet/csharplang#2208

@AArnott AArnott closed this as completed Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant