Linked by Hadrien Grasland on Wed 15th Jun 2011 07:32 UTC, submitted by ebasconp
General Development "The recently finished C++ ISO standard, with the working name of C++0x, is due to be published this summer, following the finishing touches to the ISO spec language and standards wonks agreed upon in March."
Thread beginning with comment 477402
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Meh... it's D for me now.....
by Timmmm on Thu 16th Jun 2011 14:05 UTC in reply to "Meh... it's D for me now..... "
Timmmm
Member since:
2006-07-25

The fact that it has garbage collection built-in is nice as well.


That's one of the things keeping me sticking with C++. Garbage collection is an ugly and unsatisfying solution to a minor problem.

I think a better solution is judicious use of reference counting & shallow copying. Then you get to keep speed, determinism, smoothness (no stopping the world), and deterministic destruction (for RAII).

Reply Parent Score: 5

ebasconp Member since:
2006-05-09

Completely agree.

One friend told me something like: "You do not need garbage collection if you do not produce garbage!"... really true!!

Reply Parent Score: 2

Alfman Member since:
2011-01-28

Timmmm,

"That's one of the things keeping me sticking with C++. Garbage collection is an ugly and unsatisfying solution to a minor problem."


I think it's more a matter of opinion.

The problem with delete in a managed language is that the language can no longer vouch for program safeness with regards to preventing code from corrupting it's own structures. Deleting an object which is still in use could cause stray pointers/references.

With this in mind, does your aversion to garbage collection (and implicitly managed languages) carry over to environments like Perl/PHP/javascript for web development? I think using unmanaged C/C++ would be rather dangerous.



"I think a better solution is judicious use of reference counting & shallow copying. Then you get to keep speed, determinism, smoothness (no stopping the world), and deterministic destruction (for RAII)."


It's tempting to think so, but it's not safe to assume that malloc/free is always going to be faster than GC. There are alot of factors, it came up not long ago:

http://www.osnews.com/comments/24843

Are you thinking that the language ought to enforce reference counting on objects or just that programmers should use it as a design pattern?

One issue with ref counting is cyclic data structures. Though it may be uncommon, I'd hate for any language to be limited in this fashion: Visual basic used ref counting and was susceptible to memory leaks in cyclic structures.

I personally don't have any problem using new/delete myself, but I don't have any serious objections to managed memory if it helps devs produce more reliable code.

Edited 2011-06-18 03:45 UTC

Reply Parent Score: 2

moondevil Member since:
2005-07-08

I personally don't have any problem using new/delete myself, but I don't have any serious objections to managed memory if it helps devs produce more reliable code.


Same thing here.

Actually C++ was the last systems programming language to be designed without GC. And Bjarne only did it because of the bad experiences with the Simula GC. You can read about it on "Design and Evolution of C++".

Luckly the language is powerfull enough that now refcounting classes are part of the standard library. So you get to choose when to use what.

Plus the C++11 standard defined a GC API, so that compiler vendors can provide their own GC if they so desire. You can read more about it here,

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2527.html
http://portal.acm.org/citation.cfm?doid=1542431.1542437

Reply Parent Score: 2