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

17th Aug 2018, 9:49 PM
RoboCybernetic
RoboCybernetic - avatar
4 odpowiedzi
+ 4
Well they are very important part of the language and you cannot master it without skipping them.
17th Aug 2018, 10:49 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 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
17th Aug 2018, 10:22 PM
Dlite
Dlite - avatar
+ 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#.
18th Aug 2018, 3:39 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 1
Thanks
18th Aug 2018, 5:57 AM
RoboCybernetic
RoboCybernetic - avatar