5 ms·
If Rust doesn't allow pointer arithmetic and conjuring up a pointer using '&' like in C, it doesn't make me feel there is anything special here.
by hobbyist 14y ago
If Rust doesn't allow pointer arithmetic and conjuring up a pointer using '&' like in C, it doesn't make me feel there is anything special here.
- pcwalton 14y agoIf you have a slice of a vector (`&[T]`), then you can also move it forward, like pointer arithmetic in C except checked to ensure that you don't overflow the bounds of the vector. Of course, if you have an unsafe pointer, then you can perform raw pointer arithmetic on it as well. You can create references using `&`, although I didn't show it in this overview.
- pjmlp 14y agoPointer arithmetic should be confined to unsafe/system blocks as it only makes sense when writing low level code like device drivers.