I was reading some source code files in C and C++ (mainly C)…
I know the meaning of ‘static’ keyword is that static functions are functions that are only visible to other functions in the same file. In another context I read up it’s nice to use static functions in cases where we don’t want them to be used outside from the file they are written…
I was reading one source code file as I mentioned before, and I saw that ALL the functions (except the main) were static…Because there are not other additional files linked with the main source code .c file (not even headers), logically why should I put static before all functions? From WHAT should they be protected when there’s only 1 source file?!
EDIT: IMHO I think those keywords are put just to make the code look bigger and heavier..
It is hard to guess in isolation, but my assumption would be that it was written by someone who assumes that more files might be added at some point (or this file included in another project), so gives the least necessary access for the code to function. Essentially limiting the public API to the minimum.