Re: Array optimizing problem in C++?
lew@lewscanon.com says...
This is also the common
claim made by the expert writers in software development, that having the GC
managed by the platform eases development and reduces difficulty and bugs.
Jerry Coffin wrote:
It's a claim that's often made. _Most_ of the people I've seen make the
claim fall into two categories:
1) they have a vested interest in the claim being believed.
2) their expertise seems highly questionable.
There certainly _are_ exceptions, but they appear (to me) to be a rather
small minority.
Are you flame-baiting here? The claims I've seen come from well-respected
authors who neither have "questionable" expertise nor an overt vested interest
in anything but the truth. They aren't putzes.
You are mistaken.
What is it about your experience that makes it harder for you?
First of all, the exceptions that have to be dealt with -- RAII is more
or less taken away from you, but most of the resources it manages are no
longer managed automatically.
How is that different in non-GC environments?
Second, the fact that all the GC's I've seen are just plain wrong too often, such as freeing memory that's no
longer used inside of the program, but its address has been passed to
the OS, which is still using it.
That has never happened in any instance in Java that I've every heard of, over
the last decade-plus of using it.
Java is not free of memory errors because you have GC. It sounds like you're
describing JNI scenarios, analogous to using a C++ program to deal with an
external resource, and liberating the variable prior to releasing the
resource. That's a programming mistake, not a language flaw.
--
Lew