Re: Adding garbage collection to C++

mw@ki.fht-mannheim.de (Marc Wachowitz)
Thu, 13 Aug 1992 11:40:23 GMT

          From comp.compilers

Related articles
Adding garbage collection to C++ Dain.Samples@UC.EDU (1992-08-11)
Re: Adding garbage collection to C++ tmb@arolla.idiap.ch (1992-08-12)
Re: Adding garbage collection to C++ mw@ki.fht-mannheim.de (1992-08-13)
Re: Adding garbage collection to C++ kelvin@kickapoo.cs.iastate.edu (1992-08-13)
Re: Adding garbage collection to C++ fjh@cs.mu.OZ.AU (1992-08-14)
Re: Adding garbage collection to C++ jos@and.nl (1992-08-14)
Re: Adding garbage collection to C++ henry@zoo.toronto.edu (1992-08-14)
Re: Adding garbage collection to C++ bill@amber.ssd.csd.harris.com (1992-08-14)
Re: Adding garbage collection to C++ pardo@cs.washington.edu (1992-08-15)
[8 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: mw@ki.fht-mannheim.de (Marc Wachowitz)
Organization: Fachhochschule fuer Technik Mannheim
Date: Thu, 13 Aug 1992 11:40:23 GMT
References: 92-08-052
Keywords: C, GC

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]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.