From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-20 16:00:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 20 Jun 2003 19:02:26 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: <1054751321.434656@master.nyc.kbcfp.com> <7gBHa.12174$KF1.273806@amstwist00> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: 20 Jun 2003 12:45:27 -0400 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPvOSfkHMCo9UcraBAQFcvAH8DapEmquMMRlYyaepWkpLeE9MXNQnC6i/ TY3haT/NQgIpjeimh4O1tAdtSWMbECfkBnrdvHFyE11tSZzK908pZQ== =Fpu/ Xref: archiver1.google.com comp.lang.ada:39511 comp.lang.c++.moderated:68842 Date: 2003-06-20T19:02:26-04:00 List-Id: kanze@gabi-soft.fr writes: > Wesley Groleau wrote in message > news:... > > > and not necessarily easier. Garbage collection might make it harder > > > to manage resources, not easier. > > > It also makes it easier to not think about it, and continue not > > thinking about it until you find out the hard way in some case that > > you should have thought about it. > > That's true for just about any tool that makes programming easier:-). I strongly disagree with this generalization. Ada makes programming easier, but forces me to think about what's important. > Garbage collection is a tool. It makes life simpler, and safer, for > the programmer. You might say that garbage collection is to memory > management what a high level language is to coding. Hmm. I would rather say that garbage collection is to memory management as soft typing is to data structure design; it lets you easily implement bad designs. > Neither free you from having to consider the issues at the design > stage, but once your design is clean, and the issues addressed, the > implementation is significantly easier to get right with the modern > tool. Again, I disagree. It is easier to address memory management with a properly designed container library than with garbage collection. Especially in a real-time system, when it is critical to bound every operation's execution time. > > > Besides, memory is just one kind of resource, and GC does > > > nothing for other kinds. .... > > > Like: closing files, decrementing usage counts, > > flushing file buffers and cached data, > > commiting or cancelling database transactions, ... > > There is a major difference between these "resources" and memory. They > generally can't (or shouldn't) be deferred. The act of "freeing" the > resource has side effects which are pertinent to the observable behavior > of the program. True. And for real-time systems, freeing memory should not be deferred either. > > That's what's nice about Ada controlled types. You can use them > > for anything with mandatory finalization, not just GC. I suppose > > C++ destructors could do the same. > > I don't know about controlled types, so I can't say, but it sounds like > it. Is the finalization called at a defined moment? Yes, when the object goes out of scope or is deallocated, same as in C++. -- -- Stephe [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]