Name Mangling in C++

Name mangling in C++ is the concept of generating a unique name for an identifier by the C++ compiler.  Name mangling is also known as Name Decoration.  Implementation is compiler specific.  Name Mangling is classified as a Application Binary Interface issue (ABI).

Name mangling ensure that methods that have the same name are compiled to be uniquely identified and packaged so that the linker can identifier the correct method.   Name mangling is also used to uniquely identify global and local variables with the same name.

Name Mangling is not standardized by C++ for numerous issues.  One of them being that in C++ symbols can be exported with DLLs.  Because different name mangling schemes are used by different compilers symbols that are unresolved can be detected at linkage time as opposed to at run time which otherwise  could result in undefined behavior or simply a crash of your application.

Name Mangling is an important concept to be aware of if you are distributing C++ libraries or APIs.

Advertisements
This entry was posted in Development and tagged . Bookmark the permalink.

2 Responses to Name Mangling in C++

  1. mohammed says:

    good………….

  2. sag says:

    asked in all india ONGC entrance examination 2011

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s