These requirements enable method overloading and detection of some bugs (such as using different definitions of a function when compiling different source files). Later programming languages, like C++, defined stricter requirements for routines to be considered "equal", such as the parameter types, return type, and calling convention of a function. The simple programming languages of the 1970s, like C, only distinguished subroutines by their name, ignoring other information including parameter and return types. For example, to correctly link a function it needs its name, the number of arguments and their types, and so on. The linker needs a great deal of information on each program entity. It is required in these use cases because each signature might require different, specialized calling convention in the machine code.Īny object code produced by compilers is usually linked with other pieces of object code (produced by the same or another compiler) by a type of program called a linker. The need for name mangling arises where the language allows different entities to be named with the same identifier as long as they occupy a different namespace (typically defined by a module, class, or explicit namespace directive) or have different signatures (such as in function overloading). It provides a way of encoding additional information in the name of a function, structure, class or another datatype in order to pass more semantic information from the compiler to the linker. In compiler construction, name mangling (also called name decoration) is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages. ( Learn how and when to remove this template message) JSTOR ( December 2011) ( Learn how and when to remove this template message).Unsourced material may be challenged and removed. Please help improve this article by adding citations to reliable sources. This article needs additional citations for verification.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |