Re:Checked C
by 1980phipsi on Wednesday December 21, 2022 @03:24PM
(#34085927)
Why?
[ Parent
| on HN ]
I'd guess it's because that's what C++ does. Though it's unclear to me that C++-style iteration (where you increment a running pointer until you reach an EOI pointer) is much used in C.
Re:Checked C
by WalterBright on Wednesday December 21, 2022 @04:00PM
(#34086327)
Storing two pointers into the same array is a memory safety problem. It's hard to implement a borrow checker when there are two live mutable pointers into the same memory object.
I would expect the borrow checker to treat a slice as a logical pointer to all elements that are addressable through it, regardless of how it's implemented under the hood.