C++ is removing a Java feature that nobody knew it had
C++ 23 is coming. While much of the focus is on the features being added to the programming language, there are a few being removed as well. One such feature is garbage collection, a staple of rival language Java, whose removal had swathes of engineers saying "wait... C++ had GC?"
Garbage collection is a feature of code operating through a virtual machine, expected of a language like Java. Its function is to delete code no longer in use by the machine. C++ meanwhile, is a low-level language that speaks directly to hardware, making the need for this seemingly obsolete. But Spotify engineer Sandor Dargo says its most effective implementation "is having virtual machines written in C++ for other languages that are garbage collected."
As pointed out by Dargo, garbage collection has been a part of C++ since 2008, but the new edition will be removing it completely. Those that knew of its existence likely weren't fans either. He says garbage collection was "unimplemented, confusing and pretty useless."
From an algorithmic trading perspective, the fact it would even have GC at all is very ironic. Elite Java traders spend most of their time trying to avoid using it, as the process tends to slow low-latency code down.
Engineers on Hacker News were more shocked at its inclusion in the first place than its removal. "At first glance, I thought this was satirical," one said. Another called it "so obscure that even seasoned people who have worked with this for many years didn't know about it." Chances are it's not the only feature a select few know of; another developer says, "I doubt any one person can keep all of C++ inside their head."
Did you know C++ had garbage collection? Let us know in the comments, or tell us any implementations of it that would actually be worth doing.
Click here to create a profile on eFinancialCareers and make yourself visible to recruiters hiring for top jobs in technology and finance. To stay informed, Sign up here to get Morning Coffee in your inbox or sign up to our new Technology Newsletter
Have a confidential story, tip, or comment you’d like to share? Contact: +44 7537 182250 (SMS, Whatsapp or voicemail). Telegram: @SarahButcher. Click here to fill in our anonymous form, or email firstname.lastname@example.org. Signal also available
Bear with us if you leave a comment at the bottom of this article: all our comments are moderated by human beings. Sometimes these humans might be asleep, or away from their desks, so it may take a while for your comment to appear. Eventually it will – unless it’s offensive or libelous (in which case it won’t.)