Let's take step by step.

Can we agree that the following is true always?

char*  ptr;
  The least significant nibble of 'ptr' can be any value in {0,1,2,3,4,5,6,7,8}

char**  c_ptr = &ptr;
  The least significant nibble of 'c_ptr' can have only 2 values : {0, alignof(void*)}

The former is to be able to index any item of a char array.
And the later depends on the platform.

Since the later is alway guaranteed, then we can use some N lower bits (which are always 0), to store a bit tag.

This tagging cannot be applied to the former because of pointer arithmetics.

Is there an exception to the above?
And on which platform?

Sent from my Galaxy


-------- Original message --------
From: Jens Maurer via Std-Proposals <std-proposals@lists.isocpp.org>
Date: 1/29/25 4:56 PM (GMT+01:00)
To: std-proposals@lists.isocpp.org
Cc: Jens Maurer <jens.maurer@gmx.net>
Subject: Re: [std-proposals] Make all data pointers intercompatible



On 29/01/2025 16.29, Frederick Virchanza Gotham via Std-Proposals wrote:
> On Wed, Jan 29, 2025 at 2:46 PM Tom Honermann wrote:
>>
>> 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.
>
>
> Pointer tagging is UB. So if you don't like my idea of making all data
> pointers the same, then alternatively perhaps pointer tagging should
> be made well-defined.

Here you are:  https://wg21.link/p3125r3

Jens
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals