2 ms·
> [D]on't make the mistake C, C++, and Rust did, using a prefix dereference operator. This is only a mistake when the deference is frequently followed by postf
by lifthrasiir 5y ago
> [D]on't make the mistake C, C++, and Rust did, using a prefix dereference operator.
This is only a mistake when the deference is frequently followed by postfix operators, in most cases field and method accesses. Unlike C or C++, Rust does auto-dereference that essentially eliminates such situations and thus a prefix operator doesn't do much harm.
- ncmncm 5y agoC and C++ also have a postfix field access operator. People still have to write "(*p)->m". Being obliged to write "(*p).m" is no better.