A while ago, a wrote a function as part of a program, and unknowingly gave the function the same name as a function in one of the libraries I'd included. I got round the problem by declaring my function as 'static'.
Since then, I now almost out of habit declare every one of my functions as static. Is this a bad thing to do? I don't really understand the implications of a static function.
>Is this a bad thing to do?
No. If functions are only used within a certain file, declare them such that they can only be accessed by functions in those file. Using static functions normally and non-static functions only when necessary usually results in a well structured program.
The same counts for global variables. Don't use global variables too much, they can make a program hard to understand, debug and maintain. But if you need them, make them static when they are only use them in the file and non-static when used by other modules.
Thanks for the advice.
Looks like I've accidentally been doing the right thing for once!