"Blue Ocean" <bl*********@hotmail.com> a écrit dans le message de
news:33**************************@posting.google.c om...
In standard C, what is the effect of declaring a method extern. In
what cases should I use this? Programs that I've compiled with more
than one source files and multiple headers still seem to work even
when a method in one file calls a method in another, even though I've
yet to declare any method extern. Why?
Functions are extern by default. "Methods" exist (maybe) in C++
but not in C. In C "methods" are not associated to a data packet
and called just "Functions".
As you may have noticed, in C functions do not receive an
implicit object pointer (the "this" argument).
So they aren't methods. They are by default extern, i.e. visible
in other modules. If you do not want them to be visible
you define them as static, like this
static int myFn(int someArg)
{}
This means "myFn" will not be visible outside the current unit.