2 ms·
Sorry, I misspoke. But this wasn't meant to be about Rust. My point was that: if you dump slices/fat pointers into C, how does it help? Slices/fat pointers a
by bsder 6y ago
Sorry, I misspoke. But this wasn't meant to be about Rust.
My point was that: if you dump slices/fat pointers into C, how does it help?
Slices/fat pointers and the corresponding checks are a runtime thing, and that's absolutely anathema to a lot of C programmers. If it's not anathema to the C programmer, they probably aren't in C anyway.
So, now you need a way so that compiled slices/fat pointers mean something, and I'm not convinced that doesn't have a lot of ramifications that are being glossed over.
- WalterBright 6y agoThe checks can be at compile time, given how good the data flow analysis is in the compiler. The rest are at runtime, presumably coming with a compiler switch to turn them off. Most people using D leave the checks on. Even without the checks, however, I can vouch that implicitly carrying around the length of the array with the array pointer is a vast improvement in the clarity of the written code.