home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1806 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.8 KB  |  63 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1992Dec16.155231.10403@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <1992Dec02.212336.26703@microsoft.com> <1992Dec4.093044.16823@jyu.fi> <1992Dec07.225634.19943@microsoft.com>
  10. Date: Wed, 16 Dec 1992 15:52:31 GMT
  11. Lines: 50
  12.  
  13. In article <1992Dec07.225634.19943@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
  14. >
  15. >|As long as we have C++ objects, i.e. in memory, their addresses (or at least the
  16. >|valid pointer values to access them) _must_ stay constant, because C++ has no
  17. >|means to automatically track down and modify all pointers to an object.
  18. >
  19. >Wrongo.  Again you confuse language and implementation.  On the contrary, 
  20. >I've written an internal implementation of C++ that does have the means to 
  21. >automatically track down and modify all pointers to an object.  There
  22. >are other systems that do this kind of thing too.  Such as early versions of
  23. >Windows.
  24.  
  25.     Certainly, such an internal tracking mechanism (Jim, you really
  26. actually wrote such a routine??) is legal with the
  27. current definition of C++ provided object identity is preserved.
  28.  
  29.     Clearly retaining a total order over such a routine,
  30. especially an incremental one, would be a heavy constraint
  31. on the sort of algorithm you would be allowed to implement.
  32.  
  33.     Even restricting the intent of such a routine
  34. to say, compaction: At the moment the only requirement would be that all the
  35. pointers to a moved object be changed in one increment.
  36. (So equality tests continue to work)
  37.  
  38. You might reorder all the objects in memory. Preserving a total order
  39. in an incremental system might be suboptimal. So that requirement
  40. would break your system OR force you to make it suboptimal.
  41. (Where suboptimal might include abandoning it altogether .. and then
  42. maybe the program wont run at all .. totally breaking the program)
  43.  
  44.     So there is a tradeoff---a class of code using Jims
  45. sneaky tricks breaks, or an as yet non-existant class
  46. of code depending on total order breaks.
  47.  
  48.     Perhaps unfortunately such a tradeoff can only be resolved
  49. one way by the committee---namely that of requiring
  50. compatibility with existing code. Because no one can be
  51. sure Jim is the only one doing sneaky tricks. Or there arent
  52. other types of legal sneaky tricks.
  53.  
  54. (** 'sneaky tricks' is not meant to be anything than the first words
  55. that popped into my head.)
  56.  
  57.  
  58. -- 
  59. ;----------------------------------------------------------------------
  60.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  61.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  62. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  63.