home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16418 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.6 KB  |  31 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!microsoft!hexnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: Making qsort type-safe
  5. Message-ID: <1992Nov17.012156.19306@microsoft.com>
  6. Date: 17 Nov 92 01:21:56 GMT
  7. Organization: Microsoft Corporation
  8. References: <1992Nov4.162131.10289@cs.brown.edu> <1992Nov12.194207.19040@cbnewsk.cb.att.com> <1992Nov13.215612.7145@netcom.com>
  9. Keywords: sorting, templates, qsort
  10. Lines: 19
  11.  
  12. In article <1992Nov13.215612.7145@netcom.com> mdr@netcom.com (Marc D. Rossner) writes:
  13. |Can you think of a good example of this?  I realize that COPYING an objects
  14. |bits may be insufficient for making a conceptually independent copy, but I
  15. |can't think why swapping the bits of two objects would not leave the two 
  16. |objects physically and conceptually swapped.
  17.  
  18. A common object-model conceptualization [whether the C++ programmer 
  19. realizes it or not] is that the identity of an object is represented
  20. by its address.  In which case swapping the bits of the objects exchanges
  21. their values, but not their identity.  In which case they remain conceptually
  22. unswapped.
  23.  
  24. If Fred is on my left and Bart is on my right and I pick the contents  
  25. of their wallets and swap them, Fred remains on my left, and Bart remains
  26. on my right.  Of course, IF I ask Fred who he is, and ask Bart who he is,
  27. and they each look in their wallets for their IDs and reply "Bart" and
  28. "Fred" respectively, THEN perhaps you can argue that conceptually they
  29. *have* been swapped.  In which case you are conceptualizing an object's
  30. identity to be its surrogate, not its address.   See "Mostly Harmless" 
  31.