🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #943

Re: Conversions to/from void*, redux

#943
From: Jim ADCOCK
Date: Mon, 11 Mar 1991 23:58
37 lines
2557 bytes
In article <3568@ux.acs.umn.edu> dhoyt@vx.acs.umn.edu writes:
|In article <27D5708A.29CF@tct.uucp>, chip@tct.uucp (Chip Salzenberg) writes...
|> ... about void* equivalent to char*

Actually, about conversions from pointers to primitive to pointers 
from non-primitives.  Also, relating to present discussions about 
run-time type testing:

Consider a C++ implementation / CPU pair that uses machine "RAM" addresses as
the representation of "primitive" pointers such as void*, char*, int*,
"C" struct*, etc, but which uses tagged pointers for the representation
of [at least] pointers/references to objects of classes with virtual functions.

I claim C++ *ought to* allow such implementations.  Such implementations 
could be interesting *at least* on lisp-machines, Rekursiv-like "OO"
architectures, and on risc machines with 48-bit pointers.  On at least
some such machines, the tagged pointers might have 48-bit representations,
the primitive pointers have 32-bit representations.  The 48-bit pointers
would be type-tag + ram-address, whereas the 32-bit pointers would be
ram-address only.  Thus conversion from class X* to char* [for example]
really would represent loss of information, that would be difficult or
impossible to recover.  -- Note: due to polymorphism, the tag part of
a class X* does not necessarily correspond to "type X" -- it might
correspond to type class XD, where XD is a class derived from class X.
Note that in pointer-tagged implementations, there would not typically
be a redundant type-tag within the object structure itself -- the whole
point of moving the tag to the pointer is to make dispatch faster, by avoiding
an indirection.

Thus I claim C++ implementations should not be *required* to support 
back-casting from pointer-to-primitive to pointer-to-non-primitive.
Such back-casting should be considered strictly implementation dependent.

Comments?  

Should the C++ language be specified in such a way so as to prohibit, 
for all time, any such implementations/CPUs ???
Technical Details
Message-ID: <71210@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad
References: <70935@microsoft.UUCP> <27D18D22.1608@tct.uucp> <71031@microsoft.UUCP> <27D5708A.29CF@tct.uucp> <3568@ux.acs.umn.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad
From: jimad@microsoft.UUCP (Jim ADCOCK)
Newsgroups: comp.std.c++
Subject: Re: Conversions to/from void*, redux
Keywords: Sun, C++
Message-ID: <71210@microsoft.UUCP>
Date: 11 Mar 91 23:58:21 GMT
References: <70935@microsoft.UUCP> <27D18D22.1608@tct.uucp> <71031@microsoft.UUCP> <27D5708A.29CF@tct.uucp> <3568@ux.acs.umn.edu>
Reply-To: jimad@microsoft.UUCP (Jim ADCOCK)
Organization: Microsoft Corp., Redmond WA
Lines: 37