Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Name mangling
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Technique in compiler construction}} {{About|name mangling in computer languages|name mangling in file systems|filename mangling|other uses|Name conflict (disambiguation){{!}}Name conflict}} {{Multiple issues|{{original research|date=September 2016}}{{More citations needed|date=December 2011}}}} 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 language]]s. It provides means to encode added information in the name of a [[Function (computer programming)|function]], [[Record (computer science)|structure]], [[Class (computer programming)|class]] or another [[data type]], to pass more semantic information from the [[compiler]] to the [[Linker (computing)|linker]]. The need for name mangling arises where a 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 [[type signature]]s (such as in [[function overloading]]). It is required in these uses because each signature might require different, specialized [[calling convention]] in the [[machine code]]. Any [[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 (computing)|linker]]. The linker needs a great deal of information on each program entity. For example, to correctly link a function it needs its name, the number of [[Argument of a function|arguments]] and their types, and so on. The simple programming languages of the 1970s, like [[C (programming language)|C]], only distinguished [[subroutine]]s by their name, ignoring other information including [[Parameter (computer programming)|parameter]] and return types. Later 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. These requirements enable method overloading and detection of some bugs (such as using different definitions of a function when compiling different [[source code]] files). These stricter requirements needed to work with extant [[programming tool]]s and conventions. Thus, added requirements were encoded in the name of the symbol, since that was the only information a traditional linker had about a symbol.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)