Declaration found during unqualified name lookup
问题 Consider the following simple example: #include <iostream> int a=5;//1 extern int a;//2 int main(){ cout << a; } The standard said that (sec. 3.4/1): Name lookup shall find an unambiguous declaration for the name and (sec. 3.4.1/1): name lookup ends as soon as a declaration is found for the name. Question: What declaration (1 or 2) will be found in my case and why? 回答1: That clause says that name lookup stops when it hits int a=5; There is only one name here, a in the global namespace. It's