Newsgroups: alt.lang.design,comp.lang.c++,comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!newsfeed.pitt.edu!gatech!swrinde!ihnp4.ucsd.edu!nmt.edu!jefu
From: jefu@osiris.cs.nmt.edu (Jeffrey Putnam)
Subject: Re: Comparing productivity: LisP against C++ (was Re: Reference Counting)
Message-ID: <1995Jan4.180806.9933@nmt.edu>
Sender: news@nmt.edu
Nntp-Posting-Host: osiris.nmt.edu
Organization: The Museum of Differential Geometry
References: <D16Ho3.4BE@lcpd2.SanDiegoCA.NCR.COM> <3e30ag$ar1@wariat.wariat.org> <19941231.180912.425222.NETNEWS@UICVM.UIC.EDU> <3e9bd1$mtp@wariat.wariat.org>
Date: Wed, 4 Jan 1995 18:08:06 GMT
Lines: 37
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:105884 comp.lang.lisp:16264

In article <3e9bd1$mtp@wariat.wariat.org>,
Robert J. Brown <rj@wariat.org> wrote:

>My point was that MOST C/C++ programmers never even *CONSIDER* gc an
>option when designing a system.  This is probably a pretty good choice
>most of the time, since C (unlike Lisp) is not designed to be garbage
>collectable.  To safely use gc on a C package would require a volunatrily
>imposed discipline on the programmers, whereas Lisp hardly even lets
>you program in such a way as to hinder automatic gc.

>No, you are right, gc is not a good fit for a lnguage like C, but that
>does not mean that it is not a good fit for some of the more difficult
>problems C programmers try to solve.

I've written a pile of C, C++, Lisp, and whatever else over the years
and dont understand this.  Portable C (the "imposed discipline") shouldnt
have any problem with just dropping a garbage collector in.  

I've a genetic programming program written in C and wanted to reduce its
memory demands.  The best way to do this was to find a way to share
structure - the memory management for this by hand would have been
terrifying.  I just dropped in the Boehm garbage collector and removed
all the "free"s in the code and it all ran - and since the structure 
sharing reduced memory usage, on the whole it ran a lot faster.  

(My thanks, plaudits, admiration to Hans Boehm and Xerox!) 

There are probably places where C code couldnt have a GC dropped in,  
but these are usually the kinds of places where you're doing tricky
code - like memory allocation itself, and are often enough unportable.



-- 

jefu@nmt.edu  -- Jeff Putnam, New Mexico Tech, Socorro, NM
"You never learn anything, you just get used to it."
