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

“Unsafe” disables borrow checking in Rust, which is part of the type system. C# also has a (different) “unsafe”.


Conceptually speaking they are quite close: both let you write code C-style with raw pointers within unsafe blocks. Similar to Rust, C# also has a subset of Unsafe and Marshal APIs which explicitly indicate their risk for bypassing compiler or language checks when either you know what you are doing or when whatever goal they achieve is not expressible with safe code.


unsafe does not disable the borrow checker, it allows calling functions that could not be otherwise written in code that is OK'd by the borrow checker.




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

Search: