Global Information Lookup Global Information

Name mangling information


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.

It provides means to encode added information in the name of a function, structure, class or another data type, to pass more semantic information from the compiler to the 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 signatures (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. 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 arguments and their types, and so on.

The simple programming languages of the 1970s, like C, only distinguished subroutines by their name, ignoring other information including 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 tools 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.

Another use of name mangling is for detecting added non-signature related changes, such as function purity, or whether it can potentially throw an exception or trigger garbage collection. An example of a language doing this is D.[1][2] These are more of a simplified error checking. For example, functions int f(); and int g(int) pure; could be compiled into one object file, but then their signatures changed to float f(); int g(int); and used to compile other source calling it. At link time the linker will detect there is no function f(int) and return an error. Similarly, the linker will not be able to detect that the return type of f is different, and return an error. Otherwise, incompatible calling conventions would be used, and most likely produce the wrong result or crash the program. Mangling doesn't usually capture every detail of the calling process. For example, it doesn't fully prevent errors like changes of data members of a struct or class. For example, struct S {}; void f(S) {} could be compiled into one object file, then the definition for S changed to be struct S { int x; }; and used in the compiling of a call to f(S()). In such cases, the compiler will usually use a different calling convention, but in both cases f will mangle to the same name, so the linker will not detect this problem, and the result will usually be a crash or data- or memory corruption at runtime.

  1. ^ "Application Binary Interface". Dlang.org. Retrieved 2020-05-19.
  2. ^ Rainer, Schuetze (20 December 2017). "D's Newfangled Name Mangling". The D Blog. Retrieved 2020-05-19.

and 21 Related for: Name mangling information

Request time (Page generated in 0.8623 seconds.)

Name mangling

Last Update:

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...

Word Count : 4794

Mangle

Last Update:

laundry mangle using rollers and a heavy weight Mangled packet, in computing Mangrove, woody trees or shrubs Name mangling, in computing Mangle, an animatronic...

Word Count : 91

Mangling

Last Update:

Look up mangling in Wiktionary, the free dictionary. The term mangling may refer to: name mangling in computer software using a mangle as a laundry device...

Word Count : 69

Filename mangling

Last Update:

The process of filename mangling, in computing, involves a translation of the file name for compatibility at the operating system level. It occurs when...

Word Count : 474

Name conflict

Last Update:

Name conflict may refer to: Name collision Naming collision Identifier#Implicit context and namespace conflicts Name mangling Name conflicts with minor...

Word Count : 57

Namespace

Last Update:

namespaces and names for internal use in the compiler in a process called name mangling. As well as its abstract language technical usage as described above...

Word Count : 3352

Foreign function interface

Last Update:

primary effect of the extern "C" declaration in C++ is to disable C++ name mangling. With other languages, separate utils or middleware are used, examples...

Word Count : 2129

X86 calling conventions

Last Update:

Another closely related topic is name mangling, which determines how symbol names in the code are mapped to symbol names used by the linker. Calling conventions...

Word Count : 4785

Name collision

Last Update:

further name collisions are unlikely to happen by accident. local variables, variable data items that are local to a module Name mangling Naming collision...

Word Count : 256

Cfront

Last Update:

Cfront's translation method are still found in today's C++ compilers; name mangling was originated by Cfront, as the relatively primitive linkers at the...

Word Count : 519

Address munging

Last Update:

offer email address obfuscation services to their clients. "Transparent name mangling" involves replacing characters in the address with equivalent HTML references...

Word Count : 1005

Tilde

Last Update:

be given two names—one long, more descriptive one, and one that conformed to the 8.3 format. This was accomplished with a name-mangling scheme in which...

Word Count : 6975

Application binary interface

Last Update:

prerequisites are fulfilled. ABIs can also standardize details such as the C++ name mangling, exception propagation, and calling convention between compilers on...

Word Count : 929

API

Last Update:

(computing) Interface control document List of 3D graphics APIs Microservices Name mangling Open API Open Service Interface Definitions Parsing Plugin RAML (software)...

Word Count : 5575

Type signature

Last Update:

information about a function like the name, scope and parameters. Many programming languages use name mangling in order to pass along more semantic information...

Word Count : 1305

Language binding

Last Update:

Application binary interface (ABI) Calling convention Embedded SQL Name mangling Simplified Wrapper and Interface Generator (SWIG) – interface binding...

Word Count : 496

Venomous Concept

Last Update:

extreme metal band Blood Duster (2008). The band's name is a play on Poison Idea, in the style of name-mangling Japanese hardcore acts. In February 2004, Kevin...

Word Count : 442

Java virtual machine

Last Update:

except for name mangling in method signatures and the type of boolean arrays. booleans in method signatures are mangled as Z while bytes are mangled as B....

Word Count : 3411

Rhizophora mangle

Last Update:

Rhizophora mangle, the red mangrove, is distributed in estuarine ecosystems throughout the tropics. Its viviparous "seeds", in actuality called propagules...

Word Count : 805

SWIG

Last Update:

Language binding Foreign function interface (FFI) Calling convention Name mangling Application programming interface Application binary interface Comparison...

Word Count : 891

Component Object Model

Last Update:

Engine Java remote method invocation KDE Frameworks Language binding Name mangling Portable object (computing) - cross-language, cross-platform object...

Word Count : 4675

PDF Search Engine © AllGlobal.net