Microsoft wants safer C# without turning it into Rust
Unsafe bits get a warning label in planned low-level coding shake-up
.NET product manager Richard Lander has written alengthypost describing how the team intends to improve the memorysafety of C# by introducing a new model and redefining the existing unsafekeyword, making the language more like Rust, though without giving up automaticmemory management.
"We envision a future where C# is among a set oflanguages chosen and noted for the type- and memory-safety enforcement,"said Lander.
Many C# developers never use unsafe, but it has beenpart of the language from its first release. "Writing unsafe code is likewriting C code within a C# program," said an early book called The C#Programming Language, written by its inventor Anders Hejlsberg and others. Examplesof where unsafe code is necessary include interop with the underlying operatingsystem, accessing memory-mapped devices, or implementing time-critical code. Unsafecode allows the use of pointer types, which are not tracked by the...
Copyright of this story solely belongs to theregister.com. To see the full text click HERE