home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!uwm.edu!linac!att!rutgers!faatcrl!iecc!compilers-sender
- From: mw@ki.fht-mannheim.de (Marc Wachowitz)
- Newsgroups: comp.compilers
- Subject: Re: Adding garbage collection to C++
- Keywords: C, GC
- Message-ID: <92-08-063@comp.compilers>
- Date: 13 Aug 92 11:40:23 GMT
- References: <92-08-052@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: mw@ki.fht-mannheim.de (Marc Wachowitz)
- Organization: Fachhochschule fuer Technik Mannheim
- Lines: 30
- Approved: compilers@iecc.cambridge.ma.us
-
- Thomas M. Breuel <tmb@arolla.idiap.ch> wrote:
- : As far as I can tell, ANSI-C and C++ are both fully garbage collectable
- : within the current language standard.
-
- At least you would have to be very careful when the programmer copies the
- value of the last pointer to some heap object to some memory region (e.g.
- an unsigned char[]) and changes the order of the array elements, then
- destroys the pointer. No more live reference is detectable by the
- collector, but the programmer may copy back the pointer value (again
- changing the byte order) and ... :-) I guess such manipulations would be
- possible with the current standard.
-
- : More precisely, I believe that you could compile ANSI-C to portable and
- : idiomatic CommonLisp (the main difficulty is pointers to automatic
- : variables).
-
- I'm not sure whether C would allow changing addresses; if not, you'd have
- to translate them into something else if your Lisp implementation uses a
- moving collector, which is quite likely. This is surely possible, but
- hardly very efficient - so why not use Lisp in the first place, with
- better performance :-)
- --
- Marc Wachowitz
- mw@gandalf.ki.fht-mannheim.de, 75742@novell1.rz.fht-mannheim.de
- [It is my impression that an ANSI C program is allowed to copy a pointer to
- a long and later back to a pointer of the same type. This sort of thing
- makes it hard to find all the live data. -John]
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-