home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
- From: tmb@arolla.idiap.ch (Thomas M. Breuel)
- Newsgroups: comp.lang.c++
- Subject: Re: Doubly-linked list trick (was Re: Garbage Collection for C++)
- Message-ID: <TMB.92Aug19153036@arolla.idiap.ch>
- Date: 19 Aug 92 19:30:36 GMT
- References: <1992Aug14.021547.15215@news.mentorg.com>>
- <DAVEG.92Aug14194411@synaptx.synaptics.com> <2009@appli.se>
- <16ovt2INN3nq@early-bird.think.com> <2134@appli.se>
- Sender: news@ai.mit.edu
- Reply-To: tmb@idiap.ch
- Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
- Perceptive)
- Lines: 33
- In-reply-to: niklas@appli.se's message of 19 Aug 92 08:33:14 GMT
-
- In article <2134@appli.se> niklas@appli.se (Niklas Hallqvist) writes:
-
- Emphasises mine! This means the trick WILL be portable to all platforms
- where there exists an integral type large enough (ie. almost all platforms).
- I agree that this may be a bad habit, BUT... what I wanted to tell was:
- It's REAL HARD (read: impossible) to implement GC on most architectures if
- this rule [allowing conversions of pointers to/from integers] is left in.
-
- No, it's not at all hard. Since C++ programs that rely on
- integer/pointer conversions are already unportable, a very small
- number of these already unportable programs would simply be unportable
- to a larger number of implementations. This can be done without
- "legal" conflict with the existing C++ standard.
-
- I think the standard should be modified to say that pointer/integer
- casts are legal even in the presence of GC, but that you must continue
- to hold an "unencoded" pointer to any object that you don't want to be
- garbage collected. As noted above, this statement has no effect on
- portable programs; C/C++ has undergone significantly greater changes
- than this in the past.
-
- For a more extensive discussion of these issues, I suggest looking at
- comp.compilers.
-
- Thomas.
-
- PS: Where was the outcry of indignation when, all of a sudden,
- uninitialized static member definitions didn't count as definitions
- anymore? Unlike restricting encoded pointers, this did force me to
- change some of _my_ source code.
-
- PPS: As to the XOR trick, you can use doubly linked lists of small
- arrays of elements to get equivalent space savings portably.
-