Reputation: 164
As I read here inline functions doesn't have to be inlined. So let's say we have code like this:
int a = 0;
inline void myFunc(){
extern int a;
a = 1;
}
int main(){
int a = 0;
myFunc();
}
a
variable will be assigned 1
?register
keyword for a
in main
?EDIT: the global int a
doesn't have to be declared in the same .c file
Upvotes: 0
Views: 231
Reputation: 241701
Inlining a function does not introduce it into the caller's scope. Identifiers declared within a function (such as a
in main
in your example) are not visible from other functions.
So inline
is irrelevant, and the top-level a
is the one whose value is changed.
Upvotes: 1