Re:Comparing C and C++ usage and performance with a real wor...
by nly on Sunday September 03, 2017 @02:30PM
(#15163004)
Hi Colin. This isn't an optimisation though, it's a guarantee. Member function calls are resolved statically at compile-time. Replacing indirect calls off a function pointer with direct calls (devirtualization) is an optimisation that applies to both languages equally and requires whole-program / link-time optimization.
Modern compilers make the same optimization for function pointers which are only ever set to one value, too.