|
|
|
|
|
by AnthonyMouse
4450 days ago
|
|
> But I should note that memory safety without garbage collection is just hard: it requires the entire language design to be balanced on a delicate precipice. I was thinking about this recently and I think a large part of the problem is that C arrays are too weakly typed. Array should be a different type than pointer and they shouldn't be convertible. In particular, you shouldn't be able to subscript a pointer, and the in-memory representation of an array should begin with its length. At that point the compiler can include a runtime bounds check for every array access that it can't prove is safe at compile time. |
|