0
Garbage collection in C++
I'm novice in C++. C and C++ have no garbage collection. This fact make the languages powerful but complicated. My question is: if I program in C++, I must use pointers and dynamic memory allocation always or can I skip this complicated process? Sorry for my English
4 Respostas
+ 4
Well they are very important part of the language and you cannot master it without skipping them.
+ 1
Angelo B.
There's no way you'll ever be a professional C/C++ programmer if you didn't understand and master the use of Pointers
+ 1
Angelo B. The creator of c++, Bjarne Stroustrup, says that he deliberately did not emphasize on the use of a Garbage Collector for C++ as he feels that Garbage shouldn't exist at all in the first place. So you are responsible for allocation/deallocation of pointers. Though nowadays, you can just use smart_pointers and containers and leave all the tasks to them.
http://www.stroustrup.com/bs_faq.html#garbage-collection
Also, if you are in dire need of a garbage collector, external libraries are available for the same. You can also use C++/CLI, a microsoft version of C++, as it has its own Garbage Collector like C#.
+ 1
Thanks