|
|
|
|
|
by Arnavion
1983 days ago
|
|
Filesystems, networking, ... Basically anything a program needs to interact with things outside its address space requires C interop and thus unsafe code. I sure hope your web server is listening on a socket because it's not going to be much of a web server otherwise. Then there's crypto, for which the corelib defers to the OS (CNG / openssl) because doing crypto in managed code is hard. But forget all that; even pure C# code isn't safe because it occasionally needs to hook into the CLR for unsafe things. Eg https://source.dot.net/#System.Private.CoreLib/Dictionary.cs... - unsafe code called from Dictionary.Remove |
|
> unsafe code called from Dictionary.Remove
For creating, and checking for, empty reference.
Rust standard library uses unsafe way more. That design has consequences, e.g. check this https://medium.com/@shnatsel/how-rusts-standard-library-was-...
It's somewhat harder to screw up when you can rely on VM guarantees, and don't need that level of trust in the libraries you consume.