Date: Mon, 27 Jan 2025 11:51:44 +0100
So you want to abolish alignment? And allow full type-aliasing? And with it abolish object lifetimes?
So you cannot copy the byte-representation to a local variable and back, because the object points to itself?
And you cannot use theoretical memory access functions, which can access misaligned memory, as the memory access could happen inside a member function? So you want to run member functions on misaligned memory?
Perhaps one could use or introduce relative pointers instead, similar to pointers to members?
If a class uses those, it could more likely be trivially copied?
-----Ursprüngliche Nachricht-----
Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Tiago wrote:
>
> So what is the point of this?
I want C++26 to explicitly state: "All pointer types are
intercompatible -- they all have the same size and representation",
which would allow code like:
char c;
long double *p = &c;
char *p2 = p;
*p2 = 'a';
The main use for this would be in allowing data to be misaligned in
memory. For example let's consider "std::basic_string<char32_t>" which
contains a pointer into its own buffer. If such an object is
misaligned in memory, then the pointer into the buffer might not
accurately point at the buffer. But I want the Standard to be changed
so that all pointers are the same.
There were rumours years and years ago of systems that had different
size pointers but they're all extinct now.
Received on 2025-01-27 10:55:18