When reading the book Programming: Principles and Practices using C++, 2nd Edition I came along the following statement:
...what do you do if you really need a global variable (or constant) with a complicated initializer? A plausible example would be that we wanted a default value for a Date type we were providing for a library supporting business transactions:
const Date default_date(1970,1,1); // the default date is January 1, 1970
How would we know that default_date was never used before it was initialized? Basically, we can’t know, so we shouldn’t write that definition...
What got me curious about this line of code is the implied idea of using a global variable before its definition. What did the author (Bjarne Stroupstrup) exactly mean by using a global variable before its initialization? Of course, one could have declared the variable somewhere else. But that scenario is not mentioned.