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.
C++26: remove C++
note that the
-- ->
operator is different than--->
Why do you even have pointers to pointers?
Pointer to pointer is fairly common stuff once you get serious with C++ but I’ve no idea what this abomination is supposed to even be, haha!
Mostly because at the lowest level of computing (machine code and CPU instructions), pointers are the only method (that I know of) of any kind of indirection.
At the lowest level, there are 2 types of references:
- CPU registers
- memory addresses (pointers)
Every higher level language feature for memory management (references, objects, safe pointers, garbage collection, etc) is just an abstraction over raw pointers
Pointers themselves are really just abstractions over raw integers, whose sole purpose is to index into RAM
With that in mind, pointers to pointers are a natural consequence of any kind of nested object hierarchy (linked lists, trees, objects with references to other objects, etc)
The only other kind of indirection would be self-modifying machine code (like a Wheeler Jump). But the computing world at large has nixed that idea for a multitude of reasons
linked lists, trees, objects with references to other objects
That’s not a pointer to another pointer, but a pointer to a data structure that happens to contain another pointer.
The distinction is meaningless in the land of Opcode’s and memory addresses
For example, a struct is just an imaginary “overlay” on top of a contiguous section of memory
Say you have a struct
struct Thing { int a; int b; Thing* child; } Thing foo {}
You could easily get a reference to
foo->child->b
by doing pointer arithmetic*((*((*foo) + size(int)*2)) +size(int))
(I’ve not used C much so I’ve probably got the syntax wrong)
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 😅