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