Date: Tue, 28 Jan 2025 10:58:16 +0100
Can't the other pointer types be artificially extended, e.g. to 16 bytes with all valid pointers starting with eight 0x0 bytes?
So that < is possible?
-----Ursprüngliche Nachricht-----
Von:Bo Persson via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Di 28.01.2025 10:51
Betreff:Re: [std-proposals] Make all data pointers intercompatible
An:std-proposals_at_[hidden];
CC:Bo Persson <bo_at_[hidden]>;
On 2025-01-28 at 10:42, Frederick Virchanza Gotham via Std-Proposals wrote:
> Not entirely sure where this thread has ventured off to, but let me
> get back to what I was talking about (i.e. the size of pointers).
> Given the following translation unit:
>
> class MyClass;
> MyClass *my_global_variable;
>
> The compiler doesn't know the alignment requirements of MyClass. For
> instance it might be:
>
> struct MyClass { char c; };
>
> or it could be:
>
> struct MyClass { long double f; };
>
> Therefore I think we can make the following assertion:
>
> sizeof(void*) == sizeof(char*) == sizeof( any class pointer )
>
No, the relation is >=, not ==.
A void* must be able to hold the other pointer types, so it cannot be
smaller. Not smaller is not the same as not larger.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-01-28 10:01:52