What is name lookup mechanism?

后端 未结 3 671
一向
一向 2021-02-09 00:26

I\'d like to know what C++ name lookup mechanism is.

3条回答
  •  情书的邮戳
    2021-02-09 00:58

    At its core, it's the process that the compiler uses to figure out what the given name corresponds to - be a it a variable or a function or some other language construct. It has to find the underlying language construct that the name refers to.

    e.g. When you call the function printf(), the compiler has to find the declaration for printf so that it understands what it is and can properly compile it.

    As previously pointed out, there are various name lookup mechanisms that C++ uses, and you can find information on them pretty easily with google. Wikipedia has some basic information on it as well: http://en.wikipedia.org/wiki/Name_resolution

提交回复
热议问题