4 ms·
Rust only requires you to wrap it in unsafe. And I think C# allows you to do some pretty crazy stuff too.
by SubjectToChange 3y ago
Rust only requires you to wrap it in unsafe. And I think C# allows you to do some pretty crazy stuff too.
- tjalfi 3y agoThe Kestrel web server[0] is an example of a codebase that makes extensive use of C#'s unsafe functionality. UnmanagedBufferAllocator[1], for example, looks pretty similar to how you'd write it in C++. [0] https://github.com/dotnet/aspnetcore/tree/1a56bdb671700ae6984c5a26e953726c9c8b071e/src/Servers/Kestrel https://github.com/dotnet/aspnetcore/tree/1a56bdb671700ae698... [1] https://github.com/dotnet/aspnetcore/blob/1a56bdb671700ae6984c5a26e953726c9c8b071e/src/Shared/Buffers.MemoryPool/UnmanagedBufferAllocator.cs https://github.com/dotnet/aspnetcore/blob/1a56bdb671700ae698...
- int_19h 3y agoC# cleanly separates pointers into Java-style managed references that are opaque, and C-style unmanaged pointers that are transparent but can only be used inside "unsafe" blocks.