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

  1. Path: sparky!uunet!snorkelwacker.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.92Aug19153036@arolla.idiap.ch>
  6. Date: 19 Aug 92 19:30:36 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: 33
  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. This can be done without
  29. "legal" conflict with the existing C++ standard.
  30.  
  31. I think the standard should be modified to say that pointer/integer
  32. casts are legal even in the presence of GC, but that you must continue
  33. to hold an "unencoded" pointer to any object that you don't want to be
  34. garbage collected. As noted above, this statement has no effect on
  35. portable programs; C/C++ has undergone significantly greater changes
  36. than this in the past.
  37.  
  38. For a more extensive discussion of these issues, I suggest looking at
  39. comp.compilers.
  40.  
  41.                     Thomas.
  42.  
  43. PS: Where was the outcry of indignation when, all of a sudden,
  44. uninitialized static member definitions didn't count as definitions
  45. anymore? Unlike restricting encoded pointers, this did force me to
  46. change some of _my_ source code.
  47.  
  48. PPS: As to the XOR trick, you can use doubly linked lists of small
  49. arrays of elements to get equivalent space savings portably.
  50.