Should static and inline functions be defined in the .h file?

When I write software in C, should functions be placed staticboth inlinein .hor in a file .c?

+4
source share
2 answers

Do not put a declaration or definition of a function (or variable) staticin a file .h. This defeats the point static- saving functions / variables locally.

inline- another thing - it depends on the volume intended for the function. The function inlinein is .hintended for global use and volume. Function inlinein .cis for local use only. This is the same strategy as for#define

inline extern, static . @Christoph inline.

+3

, C .h, .h , , .h, , C. , , C.

+1

Source: https://habr.com/ru/post/1584651/


All Articles