We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
If function has to be shared in two files. (or same question for varaibles also) So what to do is declare it as extern in other file.
Now in two files this function has been used. Now will it make any difference in code performance/size if I declare it in all files (20 other .c files) using extern keyword.
As according to this c-faq.com/.../decldef.html.
I am thinking to place all function declaration in one file global.h & use it.
But my other files don't need that function. Using global.h made that function visible in those files also.
Now is there any code size/performance issues.
If all C files that references a specific function - or that contains the actual implementation of the function - always include the header file that has the prototype, then the compiler will make sure that your code is consistent. I.e. that the information in the header file matches how you implemented the function and how you are using the function.