Microsoft wants safer C# without turning it into Rust

https://image.theregister.com/5246462.jpg?imageId=5246462&x=0&y=0&cropw=100&croph=100&panox=0&panoy=0&panow=100&panoh=100&width=1200&height=683

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