Re: SGCL - Garbage Collector for C++
On 1 mar, 03:11, Sam <s...@email-scan.com> wrote:
James Kanze writes:
On Mar 1, 12:24 am, Sam <s...@email-scan.com> wrote:
Richard Herring writes:
In message <cone.1204246382.29097.21741....@commodore.email-scan.com>=
,
Sam <s...@email-scan.com> writes
Let me know when you figure out why, in Java, you have to
throw all these try/catch blocks around, every time you
need to deal with files or sockets,
Because Java doesn't have local objects or destructors. Which
Java most certainly has destructors. See
java.lang.Object.finalize().
Finalization is a completely separate concept from destruction.
The proposals for garbage collection in C++ also include
finalization, but in addition to, not in lieu of destructors.
The two concepts fulfil completely different roles.
Java has local objects too. But that's going to be your
homework assignment for today.
All objects in Java are allocated dynamically. Java has a few,
special types which are not objects, and which cannot be
allocated dynamically.
has nothing to do with garbage collection.
It has everything to do with garbage collection.
Only for people who don't understand what garbage collection is
or does, or how C++ works.
in order not to run out of available file descriptors.
In Java, you use try/catch blocks, and in C++, you use
destructors.
Whoooooooosh!!! Right over your head.
It's becoming more and more apparent that you don't really know
either C++ or Java. In both languages, a file descripter is
freed when you close the file. Nothing to do with garbage
collection. Or destructors, really---you need to check the
return code of the close(), and do something if the close fails,
so you really can't defer it to the constructor anyway.
Garbage collection has nothing to do with the issue.
You keep repeating this, but repeating something, over and
over again, does not necessarily make it true.
Well, no one has yet shown the slightest relationship between
the two. In the absense of a relationship, it would seem that
you're the one repeating the same untruth over and over.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34