Is it possible to put the variable declarations in an external function? After reading from Wikipedia that:
an inline function is a function upon which the compiler has been requested to perform inline expansion. In other words, the programmer has requested that the compiler insert the complete body of the function in every place that the function is called, rather than generating code to call the function in the one place it is defined.
I hypothesized that the following might work. It did not take long for the compiler to slap my fingers :(
inline void declaration(){
int a;
}
int main(){
declaration();
a=2;
return 0;
}
inlinedoes not require the compiler to do as you ask, it is only a suggestion. Thus, inline functions must all have non-inline semantics.inline, that gcc implements multiple different versions of inline expansion, depending on whether you request C99 semantics, or gnu89 semantics, etc. It's kind of a mess.