Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Honorable but important mentions:

5. Stackalloc (C alloca), fixed buffers in structs and inline arrays

6. ref T and Span<T>, which act just like &mut T and &mut [T] in Rust (with the same syntax). They are used in both advanced and most basic APIs alike to provide zero-cost wrapping and/or slicing of arbitrary memory (managed heap, stack, NativeMemory.Alloc'd)

e.g. You can receive byte* and length from FFI and construct a (ReadOnly)Span<byte> from them. That span then can be passed to almost every method that used to work with arrays only during .NET Framework days.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: