Re: Garbage Collection - The Trash Begins To Pile Up
Sean Kelly wrote:
I agree that .NET and GC go hand in hand, but I consider this to be
necessary. All hype aside, the purpose of .NET is to provide a means
of supplying language agnostic library code. And since some languages
are garbage collected (Visual Basic and Java being notable examples),
then the solution must either support a garbage collected programming
model or leak memory.
This supports an observation I made in a post a while back that many of
these topics, GC, CTS, etc., all all interrelated, and that one must be
careful in interpreting the virtue of a proposed addition to C++. Is
it really good? Or does it greatly facilitate the market strategy of
Microsoft's languages and API strategy. I argue that, if you look at
the fundamental impetus of many of the "new" paradigms in OO technology
that are being proposed for C++, especially those that seem to disrupt
the spirit of the language, you will find that the ultimate objective
is to modify the language sufficiently so that the distinction between
it and other languages like Visual Basic are so small that the two will
essentially become one, with syntactic details. Microsoft will finally
be able to get their need-to-write-same-API-in-multiple-languages
albatross off their back, something they have been trying to do
(initially with COM, then COM+, etc.) almost since the very beginning,
and the financial savings and gains for them will be enormous. That
C++ will have become more like the "other" languages will be hardly of
any concern.
Do you never store dynamically allocated objects in STL containers?
Call me picky, but I admonish my C++ students for saying this, when
what they really mean is that _pointers_ to dynamically-allocated
objects are stored in containers. :) I am picky about this, because,
IMO, it is one of the fundamental barriers to discovering truth in form
in software engineering.
Or
do you just use pointers in those instances and manage them manually?
I have never used anything other than a raw pointer (no shared_ptr,
etc.). [I never use STL either, but I have the equivalent of STL
containers.] 98% of my coding is RAII, so it is rare that I will use
::operator new() outside of a constructor or ::operator delete outside
a destructor. Then, places where I do use naked new() and naked
delete(), they stand out.
With such a lop-sided ratio between auto memory management and manual
memory management, one would have to be extremely careless to make a
mistake.
-Le Chaud Lapin-
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]