C++ Logo

std-proposals

Advanced search

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

From: organicoman <organicoman_at_[hidden]>
Date: Wed, 29 Jan 2025 17:42:06 +0100
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_at_[hidden]> Date: 1/29/25 4:56 PM (GMT+01:00) To: std-proposals_at_[hidden] Cc: Jens Maurer <jens.maurer_at_[hidden]> 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/p3125r3Jens-- Std-Proposals mailing listStd-Proposals_at_[hidden]://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-01-29 16:42:16