C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Make all data pointers intercompatible

From: Tom Honermann <tom_at_[hidden]>
Date: Wed, 29 Jan 2025 09:46:49 -0500
On 1/29/25 8:50 AM, Frederick Virchanza Gotham via Std-Proposals wrote:
> On Wed, Jan 29, 2025 at 1:21 PM Sebastian Wittmeier wrote:
>> Whenever this pointer is converted to (void*) its address is multiplied by 8 (leftshifted by 3).
>>
>> If (void*) is converted back to (double*) the address is divided by 8.
>>
>> The roundtrip from double* to void* to double* keeps the pointer value intact.
>>
>> But only, if it is aligned correctly.
>
> You have a beautiful imagination Sebastian and I reckon you'd excel in
> the world of theatrical entertainment. Let me know if you ever write a
> stage play and I'll be front row centre.
>
> Right now this second, looking at my watch here, it's 1:44pm on
> Wednesday 29th January 2025, and all of the computers that had
> different size data pointers are all long dead. If you were to find
> one in an attic somewhere, you would probably need to solder out the
> electrolytic capacitors before applying 240v AC to it. Not even the
> microcontrollers nowadays have different size pointers.
>
> Every computer alive today has pointers the same size. Continuing to
> accommodate dead (or imaginary) computers in the C++ standard is just
> needlessly complicating things.

The C++ language isn't designed solely for mapping directly to
contemporary hardware. It is also designed to facilitate analysis and
new architectural designs. By not over-specifying behaviors and
restrictions for things like pointer representation, we reserve
implementation freedom for new techniques like (hardware) pointer
tagging/coloring, sanitizers, and hybrid architecture approaches like
CHERI. Restricting such implementation freedom needs, in my opinion, far
more motivation than has been presented so far in this thread.

Tom.

Received on 2025-01-29 14:46:54