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@lists.isocpp.org>
Gesendet: Di 28.01.2025 10:51
Betreff: Re: [std-proposals] Make all data pointers intercompatible
An: std-proposals@lists.isocpp.org;
CC: Bo Persson <bo@bo-persson.se>;
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@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals