Iam programing in C. I want some description about static and inline functions. I know that if we make a function static then it is an indication to compiler that it is under internal linkage for only one translation unit. I have following doubts regarding static and inline :
- If we make a function as static , can we use it in other translation units ...i.e in other .c files? If yes ..how?
- If we make the function as static inline what is the difference then ? How it will be treated by the compiler ?
- Does making a function as static gives the same effect as a macro?
- Treating a function to be inline is dependent on the compiler depending on the size . So is there any way that we can forcefully make it to be treated like inline?
- How we can use inline and static functions for optimization ?
Please shed some light on the above things inline. Platform is Linux, gcc compiler , C language.