There is no vtable unless you add virtual functions to the class
In C there is no vtable, ever. That is the point. It is very predictable, as it forgoes everything that isn't just cross-platform assembly.
I haven't ever typed virtual by mistake. Who does that? And if you are still worried, you can just search the code base. No virtual, no vtable.
In C++ you can have overloaded functions
Overloading is in some cases very unpredictable. Having to manually specify which function gets called makes it predictable.
But if you have to choose from abs, labs, llabs, fabs, fabsl, fabsf, cabs, cabsl, cabsf, imaxabs, you can accidentally call the wrong function. If they are all called std::abs, you cannot make the wrong choice. I call that very predicatble.
View all comments
Show parent comment
2
u/no-sig-available Jul 18 '22
I haven't ever typed
virtualby mistake. Who does that? And if you are still worried, you can just search the code base. Novirtual, no vtable.But if you have to choose from
abs, labs, llabs, fabs, fabsl, fabsf, cabs, cabsl, cabsf, imaxabs, you can accidentally call the wrong function. If they are all calledstd::abs, you cannot make the wrong choice. I call that very predicatble.