News for hackers. Stuff that matters.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by zsombor on Saturday February 28, 2015 @12:00PM (#9124228)
In 2015 clang & gcc have a more or less working devirtualization feature that eliminates the virtual overhead in a simple benchmark such as this. The compiler sees all classes and knows that a particular interface is implemented by only one class, so it simply elides the virtual table lookup. Add that features such as speculative devirtualization that can remove a surprisingly large number of virtual calls in an established code base such as Firefox: http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00007.html

If C++ will exist in 10 years from now, I predict 'virtual' to be just yet another legacy keyword.

Re:The cost of dynamic vs. static dispatch in C++ (2013) by ginko on Saturday February 28, 2015 @12:30PM (#9124336)
>If C++ will exist in 10 years from now, I predict 'virtual' to be just yet another legacy keyword.

I really doubt that. Not so much because of the virtual call overhead, but because there's plenty of cases where you really want control over how your class objects and structs look in memory. Adding a vtable entry to every struct is something you really don't want in many cases.

Re:The cost of dynamic vs. static dispatch in C++ (2013) by mbel on Saturday February 28, 2015 @12:45PM (#9124369)
Also from semantic point of view expressing which methods you are expecting to be overwritten in quite handy.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by api on Saturday February 28, 2015 @03:33PM (#9124940)
A lot of people forget about small and embedded devices.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by stinos on Saturday February 28, 2015 @03:14PM (#9124863)
If C++ will exist in 10 years from now

Apart from it being quite an interesting do-it-all type of language, solely seeing the huge amounts of existing codebases in 'slow' fields like production/manufacturing industries I am pretty sure it will.

Re:The cost of dynamic vs. static dispatch in C++ (2013) by Jimmy on Saturday February 28, 2015 @06:57PM (#9125515)
Even if new applications stopped being written in C++ today, the amount of legacy code written in C++ would ensure that there would be jobs for C++ programmers for many decades to come. But of course, people will almost certainly still be writing new C++ code 10 years from now.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by eru on Saturday February 28, 2015 @09:29PM (#9125808)
Just like they are still writing new COBOL.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by pjmlp on Sunday March 01, 2015 @02:44AM (#9126387)
And earning lots of money in doing so.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by eru on Monday March 02, 2015 @01:15AM (#9130551)
Indeed. I like to see it as hazard pay. Don't sell your soul for cheap.