News for hackers. Stuff that matters.
Re:Rust's unsafe pointer types need an overhaul by Gankra on Sunday March 20, 2022 @11:42AM (#30743591)
~ is not ->

ptr->field in C is (*ptr).field, at which point you are in whatever C's equivalent of a "place (lvalue) expression" is. This creates a weird discontinuity where you -> for the first step and then use `.` for subsequent steps and then do the standard "just kidding, it was a pointer offset all along" thing of slapping `&` in front of it.

My proposed ~ always keeps you indirected so you just use ~ all the way until you actually want to load a value from memory (which in C would implicitly happen whenever you have a nested ->).

There are no comments on this comment yet.