A header full of built-in functions, can I move the code outside the header file and still include everything?

I ended up putting a lot of small small built-in functions into the header file, which I include in many compilation units, the code is correctly embedded by the compiler, and the program works like a charm.

but now the header file is something very unusual (for the header) to make it more readable, I thought of doing something like this:

#ifndef MY_HEADER_H
#define MU_HEADER_H

static inline 
void my_fnct (my_param a);

#include "my_header.inline.c"

#endif

and the file my_header.inline.cwill look like this:

static inline 
void my_fnct (my_param a)
{
    // .. my code ..
}

then when I want these functions, I just include the header file.

my question is: is there a better way to achieve this without filling the header file with too much code? or can I do this and expect other developers to understand this code without problems?

+5
2

, . GCC ( , ​​ inline ), . gcc -flto ( GCC, , 4.6, ).

+1

, , , .inl. , . IDE, , , , .

+1

All Articles