|
|
|
|
|
by exDM69
5096 days ago
|
|
> Normally compilers does not do optimization of function calls between files anyway, so in this specific case that wouldn't matter. This is why function pointers are poison to the optimizer. There can be a 10-100x perf difference between C qsort and C++ std::sort because the use of that function pointer kills performance but in the C++ case the sort function is a template in a header file and can be inlined and then further optimized. Thankfully, all major C compilers have at least some link time optimization efforts going on. When link time optimization becomes more widely available, we can finally stop thinking about translation units and use function pointers as much as we like. |
|