How does the following work?
#include <limits>
int main()
{
const int* const foo = &std::numeric_limits<int> ::digits;
}
I got the impression that in order to accept the member address static const- ant, we had to physically define it in some translation unit to please the linker. However, looking at the pre-processed code for this TU, I could not find the external definition for the member digits(or any other relevant members).
I tested this on two compilers (VC ++ 10 and g ++ 4.2.4) and got the same results from both (i.e. it works). Is the linker automatically linked magically to the object file where this material is defined, or am I missing something obvious here?
source
share