News for hackers. Stuff that matters.
Re:Checked C by masklinn on Wednesday December 21, 2022 @03:46PM (#34086179)
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.
Re:Checked C by int_19h on Friday December 23, 2022 @06:15PM (#34111750)
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.
Re:Checked C by int_19h on Friday December 23, 2022 @06:14PM (#34111741)
This pattern originated in C; C++ iterators were specifically designed to fit it when it was already established.