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=-0.5 required=5.0 tests=BAYES_00,HEADER_SPAM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII 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-18 14:09:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsfeed.cs.wisc.edu!uwm.edu!rpi!not-for-mail From: kanze@gabi-soft.fr Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 18 Jun 2003 17:12:15 -0400 Organization: http://groups.google.com/ 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: 18 Jun 2003 03:39:05 -0700 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPvDVq0HMCo9UcraBAQFJtgIApzqhJEVgHMmQ6/er+zg++qkx/Ha4Bg4i 8KVI2GtKAXkVj2LAMGkNZqofuBUPvqP7i31LzanU3viHxtkEydLPYA== =Z4Xs Xref: archiver1.google.com comp.lang.ada:39411 comp.lang.c++.moderated:68648 Date: 2003-06-18T17:12:15-04:00 List-Id: 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:-). 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. 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. > > 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. > 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? -- James Kanze GABI Software mailto:kanze@gabi-soft.fr Conseils en informatique orient�e objet/ Beratung in objektorientierter Datenverarbeitung 11 rue de Rambouillet, 78460 Chevreuse, France, T�l. : +33 (0)1 30 23 45 16 [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]