4 ms·
>First off, Rust doesn't have pointer arithmetic. It should have avoided the "*" and "&" symbols then, IMNSHO. C# does this partially by using the "ref" keywo
by knocte 12y ago
>First off, Rust doesn't have pointer arithmetic.
It should have avoided the "*" and "&" symbols then, IMNSHO.
C# does this partially by using the "ref" keyword.
- pcwalton 12y ago> It should have avoided the "∗" and "&" symbols then, IMNSHO. Those operators aren't for pointer arithmetic… > C# does this partially by using the "ref" keyword. But C#'s reference parameters have no corresponding dereference operator, because they aren't first class and are limited to function parameters. As a result, most programs cannot be written without using the garbage collector in C#. In Rust, however, references can appear as first-class values, which makes them much more flexible—enough to supplant a garbage collector when combined with smart pointers—but requires that you annotate where they are created. `&` and `*` are well-known operators for this.
- knocte 12y ago> Those operators aren't for pointer arithmetic… That's the point of my suggestion! One looking at them will think they are pointer arithmetic, which is not pretty for newcomers.
- pcwalton 12y agoThose operators aren't for pointer arithmetic in any language I know of, including Rust, C, C++, or Go. The operators for pointer arithmetic are plus and minus (technically square brackets too in C)--that's why it's called pointer arithmetic.
- sanderjd 12y agoI think you are confusing pointers with pointer arithmetic. There is no reason you must have one to have the other.
- deleted 12y ago[deleted]