Originally Posted by
mangekyou
Good to hear! Is this the standard way of doing it even when writing bigger code that has many functions?
Not the "standard", but it is a very good practice... If your code uses a function only one time in the same .c file, it is recommended you declare it as "static". This way the compiler has a chance of making the function "inline" automatically and don't export to linker. Example:
Code:
// Make it visible only for this file...
static int f(int a, int b);
// extern by default.
int my_exported_func( int a, int b )
{ return f(a,b); } // same as 'return a+b;'
// This will be inline and nobody else will know about it!
int f(int a, int b) { return a+b; }
If you don't declare f() as static, the compiler will create inline code for the call, but will create and export the function as well.