Date: Sun, 26 Jan 2025 23:42:04 +0000
On Sun, Jan 26, 2025 at 11:17 PM Jeremy Rifkin wrote:
>
> > For example on a system where CHAR_BIT==8 but the smallest addressable unit of memory is 16 bits
>
> That's not possible https://eel.is/c++draft/basic.memobj#intro.memory-1
It's possible if the compiler hides it from the programmer. For
instance if CHAR_BIT==8, and if the CPU instructions deal with 16-Bit
operands, then you can have:
CHAR_BIT == 8
sizeof(int*) == 2
sizeof(char*) == 3
An int* is a 16-Bit number representing a memory address.
A char* is a 16-Bit number representing a memory address, with an
extra byte to indicate the offset.
>
> > For example on a system where CHAR_BIT==8 but the smallest addressable unit of memory is 16 bits
>
> That's not possible https://eel.is/c++draft/basic.memobj#intro.memory-1
It's possible if the compiler hides it from the programmer. For
instance if CHAR_BIT==8, and if the CPU instructions deal with 16-Bit
operands, then you can have:
CHAR_BIT == 8
sizeof(int*) == 2
sizeof(char*) == 3
An int* is a 16-Bit number representing a memory address.
A char* is a 16-Bit number representing a memory address, with an
extra byte to indicate the offset.
Received on 2025-01-26 23:42:12