C++ Logo

std-proposals

Advanced search

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

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Thu, 9 May 2024 09:52:37 +0000
Did you ever work on a system where sizeof(int*) != sizeof(char*)?
Me neither.
So, I'm not sure there's an issue to be solved. If someone has that problem, then they can let us know, and we will look at specifics then.

-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Frederick Virchanza Gotham via Std-Proposals
Sent: Thursday, May 9, 2024 11:02
To: std-proposals <std-proposals_at_[hidden]>
Cc: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden].com>
Subject: [std-proposals] Make all data pointers intercompatible

In the past I've heard of C/C++ compilers that have a char* that's bigger than an int* -- because the char pointer is a memory address plus a numerical offset (0 - 3) into a word. In the real world though I've never encountered such a compiler but I'll believe the rumour.
The closest to this I've ever encountered is the Texas Instruments
F28069 microcontroller whose smallest addressable unit of memory is 16 bits. When they were designing the compiler for the F28069, they could have provided 8-Bit char's, and then a char* would need to be bigger than an int*, but instead they just decided to make CHAR_BIT == 16, meaning that all data pointers are the same size.

So, If there is no extant C++23 compiler nowadays that has a char* that's bigger than any other data pointer, then would it make sense in the C++26 standard to say that all data pointers are intercompatible?

Note that I'm not talking about code pointers here (i.e. I'm maintaining the distinction between data pointers and code pointers).
--
Std-Proposals mailing list
Std-Proposals_at_lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-05-09 09:52:39