c - Should the static and inline functions be defined in .h file? -
when write software in c, should put static
, inline
functions in .h
or in .c
file?
do not put declaration nor definition of static
function (or variable) in .h
file. defeats points of static
- keeping functions/variables local.
inline
matter - depends on scope meant function. inline
function in .h
meant global usage , scope. inline
function in .c
meant local usage only. same strategy used #define
inline
functions can extern
, static
or unspecified. @christoph explains inline
scope issues.
Comments
Post a Comment