Date: Tue, 28 Jan 2025 13:48:40 +0100
Frederick, Remember that C/C++ slogant is to keep backward compatibility for 50 years or more.That is, the processors that use segmentation addressing, like real mode intel CPU's should be supported, other processors like the Z80 which uses 16bit segmented addressing mode....etc.On the other side, "relaxed" is better than "strict" rules, because it will englobe old and new architectures, especially if it works fine.But there is cost for that.Look at this scenario. template<typename T>struct A{T* ptr = &m_d;T m_d;};If on some architecture where sizeof(T*) is so small that it cannot point to a memory segment (for example the stack segment), then you will be faced with a problem where you cannot allocate the above structure in that memory segment.Expl: for T = char and sizeof(char*) ==2, and the architecture is 32bit address space.Then you will never be able to create a stack variable of type A<char>, because A::ptr cannot point to a 32bit memory address in the stack segment, yet this scenario is totally fine. How?Behind the scene, the compiler could promote sizeof(char*) from 2 to 4, so it can access the whole address space, or it can use a segment and an index, or some other technique that I don't know of....all these are extra CPU instructions and bookkeeping.In conclusion, what you are asking for is sharp and decisive, but the state of the world dectates otherwise.Sent from my Galaxy
-------- Original message --------From: Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Date: 1/28/25 12:25 PM (GMT+01:00) To: std-proposals <std-proposals_at_[hidden]> Cc: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]> Subject: Re: [std-proposals] Make all data pointers intercompatible On Tue, Jan 28, 2025 at 10:12 AM organicoman wrote:>> sizeof(void*) >= sizeof(char*)The logic centres of my brain are gagging right now.Why on earth would "void*" ever be any different than "char*"? I meanreally -- use the entirety of your imagination here to pose apossibility to me. But a *real* *world* possibility, not some airyfairy 1930's supercomputer that's being repurposed by Trump's Stargateguys to hit the market in 2035 to overtake the quantum stuff.It should be spelled out clearly in the C++26 Standard as follows: (1) void* has identical size and representation to char* (2) all data pointer types are intercompatibleAnd just as an aside . . . we have std::uintptr_t, so we should alsohave std::uint_funcptr_t.-- Std-Proposals mailing listStd-Proposals_at_[hidden]://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
-------- Original message --------From: Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Date: 1/28/25 12:25 PM (GMT+01:00) To: std-proposals <std-proposals_at_[hidden]> Cc: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]> Subject: Re: [std-proposals] Make all data pointers intercompatible On Tue, Jan 28, 2025 at 10:12 AM organicoman wrote:>> sizeof(void*) >= sizeof(char*)The logic centres of my brain are gagging right now.Why on earth would "void*" ever be any different than "char*"? I meanreally -- use the entirety of your imagination here to pose apossibility to me. But a *real* *world* possibility, not some airyfairy 1930's supercomputer that's being repurposed by Trump's Stargateguys to hit the market in 2035 to overtake the quantum stuff.It should be spelled out clearly in the C++26 Standard as follows: (1) void* has identical size and representation to char* (2) all data pointer types are intercompatibleAnd just as an aside . . . we have std::uintptr_t, so we should alsohave std::uint_funcptr_t.-- Std-Proposals mailing listStd-Proposals_at_[hidden]://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-01-28 12:48:47