I’m not sure if this is serious or not and that scares me.
Rest of the world: We’re deprecating C++ due to lack of memory safety. Please consider doing something for safety.
C++ commite: Here’s a new convenient operator to make it easier to do a potentially unsafe, multi-level pointer dereference.
I pray for this to be real because it’s the perfect syntactic sugar for C++. The kind that you’d think makes sense if you didn’t have to write C++ for anything more complex than a high school project.
Right? Every C++ feature needs to be lightly cursed.
C++26: remove C++
C++26: The Rust Book
Violates the Law of Demeter
Please don’t give them ideas
the :================D operator
I honestly don’t know why they even have -> instead of just a dot like everyone else. The compiler knows whether it’s a record, object, pointer, or any level of pointer to pointers.
Why make the programmer do the donkey work?
Operator overloading allows you to redefine what each operator does. It’s essential to achieve a truly fucked up code base
It’s important for objects that can be dereferenced. Smart pointers have methods that can be accessed with dot syntax like
swap()
. You can still dereference through a smart pointer using arrow syntax to access methods on the referenced type since they overload theoperator->()
method.
Why do you even have pointers to pointers?
Pointers just point to memory addresses, and because pointers are stored in memory addresses, it just kind of naturally falls out that way.
many reasons, for example
- multidimensional arrays
- arrays of function pointers
- pass by reference of a pointer
In two of your cases this operator is pretty shit because at some point you’ll probably want to offset the access (this isn’t a knock at you but at the feature).
This operator would only really be relevant to the last case which rarely comes up outside of infrastructure/library work (building a tool building tool) and usually those code bases are cautious to adopt new features too quickly anyways for portability.
I’ve done serious C++ work (not much in the past decade though) - while references are absolutely amazing and you essentially want to pass by const ref by default I think well written maintainable C++ should maybe have a dozen heap objects tops. C++ is a better language if you generally forget that pointers and bare arrays exist.
Just again - I think you’re right and the fact that your list is only three things long (and arguably two of them would be misuses) is a pretty clear sign that this is an incredibly niche feature.
I don’t think this operator is a real feature, tbh 😅