4 ms·
It's not memory safe. There is some compile time safety and some runtime safety, but it's not comprehensive. Nullable pointers are handled by the type system
by AndyKelley 10y ago
It's not memory safe.
There is some compile time safety and some runtime safety, but it's not comprehensive.
Nullable pointers are handled by the type system at compile time.
Integer wrapping (signed or unsigned) will crash at runtime, unless you use explicit wrapping operators.
Array out of bounds will crash at runtime for slices.
There is no direct pointer arithmetic, but you can convert a pointer to a slice, and then index into the slice (which has array bounds checking). This is an example where the language is unsafe but it sort of guides the programmer into writing safe code.
- Gankro 10y agoNot being memory-safe is a bit of a bummer. Do you have a story for taking advantage of all the tooling thats been built up to defend against C's pervasive unsafety? Sanitizers being the most notable. On balance even without them this'll probably be safer than C (as long as you're avoiding like, 90% of its pitfalls). Either way, hope this works out for ya!