Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!pacbell!att!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704a-Liber) Newsgroups: comp.lang.c++ Subject: Re: classes with no data members Keywords: sizeof,empty classes,new Message-ID: <5103@ihlpf.ATT.COM> Date: 24 Jun 88 00:15:15 GMT References: <464@polari.UUCP> <7943@alice.UUCP> <470@polari.UUCP> <10399@sol.ARPA> <18223@cornell.UUCP> <423@bloom.UUCP> Reply-To: nevin1@ihlpf.UUCP (00704a-Liber,N.J.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 41 In article <423@bloom.UUCP> bobd@bloom.UUCP (Bob Donaldson) writes: >If we are getting into semantics, here, it is certainly possible (and >possibly helpful :-)) to distinguish between two DIFFERENT yet otherwise >indistinguishable instances of a type. The fact that they are different >instances itself may be of some value, even if no difference would arise >from choosing one over the other for a given purpose. We have three choices: (For purposes of this example p and q are empty objects) (1) &p NEVER equals &q (distinguishable) (2) &p ALWAYS equals &q (indistinguishable) (3) &p should never be compared to &q (comparison is undefined) I am leaning towards case 3 for a number of reasons. I have not seen any realistic examples where either case 1 is preferred over case 2 or vice-versa. p and q cannot legally be dereferenced; I find very little meaning in taking the address of nothing. If p and q are of different classes then it may be very hard (without allocating space) to guarantee that case 1 still holds. If case two is true, then there is *never* any point in comparing their addresses; therefore, there is no point in defining their addresses to be equal in the first place (it is an unnecessary restriction). Unless someone can produce some evidence to the contrary, it seems to me that there is no purpose to taking the address of an empty object. A solo posting by: -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) You are in a little maze of twisty / / _ , __o ____ email paths, all different. / (_