c++ - Using an inline function for an API -


i want create api which, on call of function, such getcpuusage(), redirects getcpuusage() function windows or linux. i'm using glue file api.h :

getcpuusage() {     #ifdef win32         getcpuusage_windows();     #endif     #ifdef __gnu_linux__        getcpuusage_linux();     #endif }  

so wonder if using inline better solution, since have, call bigger.

my question following : better use inlined function every call in situation ?

it depends on use-case of program. if consumer still c++ - inline has sense. assume reuse inside c, pascal, java ... in case inline not case. caller must export someway stable name on lib, not header file. lib linux rather transparent, while on windows need apply __dllexport keyword - not applicable inline


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

java - How to create Table using Apache PDFBox -

mpi - Why is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages -