I have a software module that consists of a *.h file and a *.c file. Variable and function declarations are located in the *.h file, whilst function definitions are located in the *.c file. Two functions within the module are helper functions that are not intended to be used outside of the module.
What is the best method of making this intent clear to users of the module?
I tried declaring the functions static
, but doing so in the *.h file results in the GCC compiler warning that the functions are "declared static but never defined". How is it that the *.h and *.c files are treated as different translation units, even though the *.c file uses the #include
directive to include the *.h file?
Is there a solution to this problem that does not involve placing the declarations of the functions that are to be made static
in the *.c file, along with their definitions? Whilst this solution does work, it breaks what I thought was the good practice of keeping declarations in a header file and definitions in an implementation file.