3 ms·
That was interesting. I found the headstands necessary to write to a raw address a bit taxing. In C you'd just use the `volatile` keyword. But being able to
by ape4 9y ago
That was interesting. I found the headstands necessary to write to a raw address a bit taxing. In C you'd just use the `volatile` keyword. But being able to localize unsafe code is a big win.
- kibwen 9y agoWorth noting that, as of a week ago in nightly, there are new convenience methods on unsafe pointers to make using them a bit more ergonomic (though unsafe operations will still require the `unsafe` keyword, of course). Here's the document describing the new changes: https://github.com/Gankro/rfcs/blob/0048bf68c56dd25cd2afed7717a3834a22471696/text/0000-unsafe-pointer-reform.md https://github.com/Gankro/rfcs/blob/0048bf68c56dd25cd2afed77... As an example: // This: ptr::read(self.ptr.offset(idx as isize)) // Becomes this: self.ptr.add(idx).read() This will be in stable Rust on May 10.