Hacker News new | ask | show | jobs
by comex 4129 days ago
Inlining a call to a function via a pointer, if the function is static and implemented in the same .c file or an included header, is a basic optimization.

I'm less sure about the compiler figuring out that the user wants (in that case) process_image to be inlined into each of the wrapper functions. However, if you don't mind a bit of nonportability, it's easy to force it to do so: mark the function to be inlined __forceinline on MSVC, __attribute__((always_inline)) on GCC/Clang/ICC/etc.