C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Section 38:
[38.9] If name mangling was standardized, could I link code compiled with compilers from different compiler vendors?

Short answer: Probably not.

In other words, some people would like to see name mangling standards incorporated into the proposed C++ ANSI standards in an attempt to avoiding having to purchase different versions of class libraries for different compiler vendors. However name mangling differences are one of the smallest differences between implementations, even on the same platform.

Here is a partial list of other differences:

  • Number and type of hidden arguments to member functions.
    • is this handled specially?
    • where is the return-by-value pointer passed?
  • Assuming a v-table is used:
    • what is its contents and layout?
    • where/how is the adjustment to this made for multiple and/or virtual inheritance?
  • How are classes laid out, including:
    • location of base classes?
    • handling of virtual base classes?
    • location of v-pointers, if they are used at all?
  • Calling convention for functions, including:
    • where are the actual parameters placed?
    • in what order are the actual parameters passed?
    • how are registers saved?
    • where does the return value go?
    • does caller or callee pop the stack after the call?
    • special rules for passing or returning structs or doubles?
    • special rules for saving registers when calling leaf functions?
  • How is the run-time-type-identification laid out?
  • How does the runtime exception handling system know which local objects need to be destructed during an exception throw?