Peter said:
On Sat, 26 Jul 2008 23:39:58 -0700, Andre Kaufmann
[...]
All due respect, C++ (not counting the GC/managed add-ons of C++/CLI)
doesn't even really have the concept of "reachable". So any claim about
what C++ does _when_ something becomes "unreachable" is necessarily
wrong, or at the very least inaccurate.
I haven't assumed that you don't have any clue about C++, if you had the
impression then please apologize - wasn't my intention. I have over 15
years C/C++ experience and we currently seem to have just a different
view point.
But C++ has >IMHO< a concept of reachable objects:
Stack allocated objects
It's quite different to the "reachable" concept of GC objects, but the
compiler has to track, when the object becomes unreachable (due to
normal program flow or exceptions) and therefore must be destroyed.
I think you mean heap allocated objects have no concept of "reachable" -
for this point I agree with you.
I understand how tempting it is for people to just assume I don't have a
clue about what I'm saying. I also realize that, having only used C++
As I wrote above, wasn't my intention to assume that.
for a decade or so before exploring C#, I may have less C++ experience
I think you have only a different viewpoint.
than others involved in the discussion. But I have found that C# and
its lack of RAII hasn't impeded my usage of C# one iota, not even when
dealing with code that has to interact with the unmanaged, C/C++-centric
paradigms of the Windows API.
Not generally I agree, but I had big trouble to deal with COM objects,
which had been passed with a high frequency to a C# callback.
Finally, just as an aside: I find the "smart pointer" example
particularly weak, as reference counting is itself overused and
Smart pointer haven't necessarily something to do with reference
pointer, although they are quite common.
And I agree - smart pointers can be error prone. But there is IMHO
simply no other chance of freeing resources directly, but using
reference counting >or< preventing sharing of objects.
And with that, I'm done. Thanks for your time and interest.
Then O.k., for me we should just agree to a different viewpoint.
One final word:
C# is a great productive language. I can live without RAII in C#,
although it would be fine to have it.
Regarding C++ I would have to criticize much more than in C#.
I've been a die hard C++ developer, but after having touched several
other languages I have the impression that other languages may be more
productive for general purpose applications as C++.
At least they are evolving faster and allow to use new concepts of
developing.
To sum it up: Simpler is commonly better
Andre