+ 1
what is garbage collection in programming language and why C++ lacks this feature. Should i prefer other languages please answer
I am a Begineer
4 Antworten
+ 8
Garbage collection automatizes the process of freeing the memory you required on the heap earlier.
That is easier to handle and safer, but you have little say about how and when this is done.
C and C++ allow you to control things more precisely, but you have to watch out for these things more.
In C++, usually classes are defined in a way that they handle this themselves: The instances require the memory and release it when they die.
When you use these data types only (like vector, map, array and such) and also use the safe methods, you will hardly feel that there is no garbage collector.
+ 4
If you are a beginner, a language like C# and Java with auto GC may be easier for you.
+ 3
it is like HonFu said.
it is also one of the reasons a language like C is used a lot for embedded software where memory usage is of utmost importance for you usually have very little of it
+ 1
Thanks buddies at some extent i am cleared about this.