[rust-dev] Building a static array of pointers

Daniel Micay danielmicay at gmail.com
Sat Apr 5 07:24:46 PDT 2014


On 05/04/14 09:23 AM, Simon Sapin wrote:
> On 05/04/2014 14:14, Corey Richardson wrote:
>> Sure, same thing as a C-style array, minus the fact that we don't have
>> Index implemented for unsafe ptrs.
> 
> Sure, but that difference is the important part. It’s idiomatic C to
> pretend that a pointer is like an array, but not in Rust.

I wouldn't say it's not idiomatic in Rust, it's simply a missing feature
for raw pointers along with pointer arithmetic operators. There were
previously operator overloads, but I had to remove them when switching
to inbounds pointer arithmetic since it no longer satisfies the safety
requirement of the traits. It can and should be added back to the
compiler, just without trait implementations.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140405/8a816eff/attachment.sig>


More information about the Rust-dev mailing list