Contents Up << >>
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.
- 1a) is 'this' handled specially?
- 1b) where is the return-by-value pointer passed?
- Assuming a vtable is used:
- 2a) what is its contents and layout?
- 2b) where/how is the adjustment to 'this' made for multiple inheritance?
- How are classes laid out, including:
- 3a) location of base classes?
- 3b) handling of virtual base classes?
- 3c) location of vtable pointers, if vtables are used?
- Calling convention for functions, including:
- 4a) does caller or callee adjust the stack?
- 4b) where are the actual parameters placed?
- 4c) in what order are the actual parameters passed?
- 4d) how are registers saved?
- 4e) where does the return value go?
- 4f) special rules for passing or returning structs or doubles?
- 4g) 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?
Miscellaneous technical issues