Article View: comp.std.c++
Article #1255Re: Must derived class reserve space for an empty base class?
From: Johan Bengtsson
Date: Tue, 15 Dec 1992 19:24
Date: Tue, 15 Dec 1992 19:24
54 lines
2890 bytes
2890 bytes
Jim Adcock (jimad@microsoft.com) wrote: : In article <5367@miramon.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes: : |Jim Adcock (jimad@microsoft.com) wrote: : |[ Questionable C example involving compiler-generated conversion : | to void* deleted ] : On the contrary, unquestionably conforming C example involving conversions : to char*. I thought ANSI C specifies void* to be the generic pointer type instead of the previous char*. Am I (and K&R2, 2nd Ed.) mistaken? I still would call your example a degenerate case. I still agree with you that it would be gross to require pointer distinctness for generic pointers. : |The fact that applying the adress operator (&) to a reference yields : |a pointer to the referred-to object is irrelevant, since a reference : |is just an alias for the referred-to object. You cannot obtain : |a pointer to a reference (as you already know). This should not cause : |any trouble. We have been talking about _pointer_ distinctness (at least I hope we have), not the result of applying the address operator (although they coincide, except for references and perhaps arrays). That is how I think we had not been clear enough. You were applying the address operator (&) to a reference-to-X (I don't have your example available). The result of that is not of type pointer-to-reference-to-X, it is simply pointer-to-X, and is a pointer to the referred-to object, not to the reference. If pointer-distinctness is blessed, then it should be clarified that taking the address of a reference is not regarded as a pointer to the reference, but a pointer to the referred-to object (to me this is already crystal clear, as defined in the ARM). : |Perhaps with this clarification you can finally agree with us? : I guess I don't understand what you are asking me to agree to? That your examples need not be relevant to the discussion, or even more preferably: That two non-generic pointers of the same type (possibly converted from pointer-to-derived) to different objects or data members should be guaranteed to compare unequal. Please? (:-) -- -------------------------------------------------------------------------- | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden | | Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490 | --------------------------------------------------------------------------
Technical Details
Message-ID:
<5386@holden.lulea.trab.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!hagbard!loglule!jbnReferences:
<1992Dec14.224035.23715@microsoft.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!hagbard!loglule!jbn From: jbn@lulea.trab.se (Johan Bengtsson) Newsgroups: comp.std.c++ Subject: Re: Must derived class reserve space for an empty base class? Message-ID: <5386@holden.lulea.trab.se> Date: 15 Dec 92 19:24:49 GMT References: <1992Dec14.224035.23715@microsoft.com> Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden Lines: 54 X-Newsreader: TIN [version 1.1 + PL8]