Reputation: 872
inline void myfunction(){
//something here
}
void main(){
void (*p)(void);
p = myfunction;
p();
}
What kind of machine code different compilers can generate for this, and in what situations?
Upvotes: 3
Views: 979
Reputation: 23218
Yes - but it will depend on your compiler and its settings what side effects will occur:
There are various ways to define inline functions; any given kind of definition might definitely emit stand-alone object code, definitely not emit stand-alone object code, or only emit stand-alone object code if it is known to be needed. Sometimes this can lead to duplication of object code...
Upvotes: 2
Reputation: 188
As your compiler will need the adress of the function, it will generate a stand alone copy of the object code.
Upvotes: 3