3 ms·
I don't think prefix usage of * operator is a big flaw. I've learned C/C++ in high school and never had a an issue with it. I've understood that the operator is
by DeathArrow 5y ago
I don't think prefix usage of * operator is a big flaw. I've learned C/C++ in high school and never had a an issue with it. I've understood that the operator is applied to the variable, not to the type and that declaring a pointer is not the same thing as dereferencing it .
Even if someone may have made a mistake when declaring a pointer in C or C++ it is something they can get over pretty fast.
- habibur 5y agoI didn't understand it either. Than learned assembly for a few months for a project -- switched back to C and everything came as natural.
- ncmncm 5y agoDereference syntax in C++ is very, very fixable. C++ could easily adopt a postfix operator^ as a synonym for prefix op*, even at this late date. Then (*p)->m could be written p^->m, or p^^.m. (The last is clearly best.) Rust, too, could do the same, for the same benefit. And C could, too, if there were any point. The only people to complain would be IDE vendors. If you were then allowed to declare a pointer argument like "char p^", or even "char^ p", you could begin to dispense with use of "*" as a unary operator. Declaring "char^ p, q" would mean both p and q are pointers, eliminating another source of beginners' confusion.