Re: extern sample in MSDN
Quote:
In the MSDN extern sample,
There are two code examples in that MSDN entry.
Quote:
It only uses one source file (compile unit) to demonstrate the usage of extern, is it correct and practical?
What do you mean by "practical"? Code examples are typically not "practical", but intended either for demonstration or to be adapted for actual use.
Re: extern sample in MSDN
Thanks laserlight,
I mean this sample. Any comments to my original question?
Code:
// specifying_linkage1.cpp
int i = 1;
void other();
int main() {
// Reference to i, defined above:
extern int i;
}
void other() {
// Address of global i assigned to pointer variable:
static int *external_i = &i;
// i will be redefined; global i no longer visible:
// int i = 16;
}
Quote:
Originally Posted by laserlight
There are two code examples in that MSDN entry.
What do you mean by "practical"? Code examples are typically not "practical", but intended either for demonstration or to be adapted for actual use.
regards,
George