home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12546 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  2.2 KB

  1. Path: sparky!uunet!snorkelwacker.mit.edu!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmb
  2. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Doubly-linked list trick (was Re: Garbage Collection for C++)
  5. Message-ID: <TMB.92Aug19133241@arolla.idiap.ch>
  6. Date: 19 Aug 92 17:32:41 GMT
  7. References: <1992Aug14.021547.15215@news.mentorg.com>>
  8.     <DAVEG.92Aug14194411@synaptx.synaptics.com> <2009@appli.se>
  9.     <16ovt2INN3nq@early-bird.think.com> <2134@appli.se>
  10. Sender: news@ai.mit.edu
  11. Reply-To: tmb@idiap.ch
  12. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  13.     Perceptive)
  14. Lines: 34
  15. In-reply-to: niklas@appli.se's message of 19 Aug 92 08:33:14 GMT
  16.  
  17. In article <2134@appli.se> niklas@appli.se (Niklas Hallqvist) writes:
  18.  
  19.    Emphasises mine!  This means the trick WILL be portable to all platforms
  20.    where there exists an integral type large enough (ie. almost all platforms).
  21.    I agree that this may be a bad habit, BUT... what I wanted to tell was:
  22.    It's REAL HARD (read: impossible) to implement GC on most architectures if
  23.    this rule [allowing conversions of pointers to/from integers] is left in.
  24.  
  25. No, it's not at all hard. Since C++ programs that rely on
  26. integer/pointer conversions are already unportable, a very small
  27. number of these already unportable programs would simply be unportable
  28. to a larger number of implementations.
  29.  
  30. In practice, none of this is a significant problem: even if you carry
  31. out integer/pointer conversions, almost all of the time you are going
  32. to keep the real pointer around, either as an integer or as a pointer.
  33. Those old program programs that don't (if any) can be run either with
  34. GC turned off, or they can be modified slightly to keep the original
  35. pointers around.
  36.  
  37. C/C++ has undergone significantly greater changes than this.
  38.  
  39. For a more extensive discussion of these issues, I suggest looking at
  40. comp.compilers.
  41.  
  42.                     Thomas.
  43.  
  44. PS: Where was the outcry of indignation when, all of a sudden,
  45. uninitialized static member definitions didn't count as definitions
  46. anymore? Unlike restricting encoded pointers, this did force me to
  47. change some of _my_ source code.
  48.  
  49. PPS: As to the XOR trick, you can use doubly linked lists of small
  50. arrays of elements to get equivalent space savings portably.
  51.