Date: Mon, 27 Jan 2025 13:56:29 +0100
On 2025-01-27 at 11:34, Frederick Virchanza Gotham via Std-Proposals wrote:
> I reply to Bo and Tiago in series below:
>
>
> Bo wrote:
>>
>> Or (3) All pointers to class type are the same size.
>>
>> Pointers to non-class types, like the earlier example of char* can still
>> have a different size.
>
>
> So you envisage something like the following on a 32-Bit system whose
> CPU instructions deal with operands with a minimum size of 32 bits?
>
> sizeof(int*) == 4
> sizeof(void*) == sizeof(char*) == sizeof(short*) == sizeof( any
> class type pointer ) == 5
>
>
I envision something like this - Unisys 36-bit mainframes
https://stackoverflow.com/a/6972551/17398063
The 36-bit int had an alignment of 1, because addresses were assigned to
words. It still stored 4 chars per word, and had part-word instructions
to select those. That part-word info had to be stored somewhere.
Also note that such machines are the reason for other "odd" rules, like
function pointers being incompatible with data pointers (because they
use separate memory banks), the 36- and 72-bit integers are one's
complement, and the floating point types are not even close to the IEEE
standard (which came much later).
The system was too old for a C++ compiler, but it did have C, and those
languages are defined to support such architectures. So the odd
languages rules are not there by chance, but because the language
designers knew that they were needed.
> I reply to Bo and Tiago in series below:
>
>
> Bo wrote:
>>
>> Or (3) All pointers to class type are the same size.
>>
>> Pointers to non-class types, like the earlier example of char* can still
>> have a different size.
>
>
> So you envisage something like the following on a 32-Bit system whose
> CPU instructions deal with operands with a minimum size of 32 bits?
>
> sizeof(int*) == 4
> sizeof(void*) == sizeof(char*) == sizeof(short*) == sizeof( any
> class type pointer ) == 5
>
>
I envision something like this - Unisys 36-bit mainframes
https://stackoverflow.com/a/6972551/17398063
The 36-bit int had an alignment of 1, because addresses were assigned to
words. It still stored 4 chars per word, and had part-word instructions
to select those. That part-word info had to be stored somewhere.
Also note that such machines are the reason for other "odd" rules, like
function pointers being incompatible with data pointers (because they
use separate memory banks), the 36- and 72-bit integers are one's
complement, and the floating point types are not even close to the IEEE
standard (which came much later).
The system was too old for a C++ compiler, but it did have C, and those
languages are defined to support such architectures. So the odd
languages rules are not there by chance, but because the language
designers knew that they were needed.
Received on 2025-01-27 12:56:36