home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1799 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  2.8 KB

  1. Path: sparky!uunet!mcsun!sunic!hagbard!loglule!jbn
  2. From: jbn@lulea.trab.se (Johan Bengtsson)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Must derived class reserve space for an empty base class?
  5. Message-ID: <5386@holden.lulea.trab.se>
  6. Date: 15 Dec 92 19:24:49 GMT
  7. References: <1992Dec14.224035.23715@microsoft.com>
  8. Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
  9. Lines: 54
  10. X-Newsreader: TIN [version 1.1 + PL8]
  11.  
  12. Jim Adcock (jimad@microsoft.com) wrote:
  13. : In article <5367@miramon.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
  14. : |Jim Adcock (jimad@microsoft.com) wrote:
  15. : |[ Questionable C example involving compiler-generated conversion
  16. : |  to void* deleted ]
  17.  
  18. : On the contrary, unquestionably conforming C example involving conversions
  19. : to char*.
  20.  
  21. I thought ANSI C specifies void* to be the generic pointer type
  22. instead of the previous char*.  Am I (and K&R2, 2nd Ed.) mistaken?
  23.  
  24. I still would call your example a degenerate case.  I still agree with you
  25. that it would be gross to require pointer distinctness for generic pointers.
  26.  
  27. : |The fact that applying the adress operator (&) to a reference yields
  28. : |a pointer to the referred-to object is irrelevant, since a reference
  29. : |is just an alias for the referred-to object.  You cannot obtain
  30. : |a pointer to a reference (as you already know).  This should not cause
  31. : |any trouble.
  32.  
  33. We have been talking about _pointer_ distinctness (at least I hope we have),
  34. not the result of applying the address operator (although they coincide,
  35. except for references and perhaps arrays).  That is how I think we had
  36. not been clear enough.
  37.  
  38. You were applying the address operator (&) to a reference-to-X (I don't
  39. have your example available).  The result of that is not of type
  40. pointer-to-reference-to-X, it is simply pointer-to-X, and is a pointer to
  41. the referred-to object, not to the reference.
  42.  
  43. If pointer-distinctness is blessed, then it should be clarified that
  44. taking the address of a reference is not regarded as a pointer to the
  45. reference, but a pointer to the referred-to object (to me this is
  46. already crystal clear, as defined in the ARM).
  47.  
  48. : |Perhaps with this clarification you can finally agree with us?
  49.  
  50. : I guess I don't understand what you are asking me to agree to?
  51.  
  52. That your examples need not be relevant to the discussion, or
  53. even more preferably:
  54.  
  55. That two non-generic pointers of the same type (possibly converted from
  56. pointer-to-derived) to different objects or data members should be
  57. guaranteed to compare unequal.
  58.  
  59. Please? (:-)
  60.  
  61. -- 
  62. --------------------------------------------------------------------------
  63. | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
  64. | Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
  65. --------------------------------------------------------------------------
  66.