Why do C++ compilers need name mangling?
Answers were Sorted based on User's Feedback
Answer / guest
Name mangling is the rule according to which C++ changes
function's name into function signature before passing that
function to a linker. This is how the linker differentiates
between different functions with the same name.
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / siva
Compilers need name mangling to support/implement function
overloading.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / achal ubbott
It is by name mangling that a c++ compiler is able to
support function overloading.It is the way of
differentiating functions based on their name,number and
order and type of parameters. Unfortunately ISO has not set
any standard procedure for mangling names. So different c++
compiler vendors implement it in different ways.
| Is This Answer Correct ? | 2 Yes | 0 No |
How to demonstrate the use of a variable?
Do class declarations end with a semicolon?
What does return 0 do in c++?
What is the difference between method and message?
What issue do auto_ptr objects address?
How can a struct in c++ differs from a struct in c?
How to declaring variables in c++?
If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?
What are enumerations?
What is vector processing?
What is fflush c++?
1)#include <iostream.h> int main() { int *a, *savea, i; savea = a = (int *) malloc(4 * sizeof(int)); for (i=0; i<4; i++) *a++ = 10 * i; for (i=0; i<4; i++) { printf("%d\n", *savea); savea += sizeof(int); } return 0; } 2)#include <iostream.h> int main() { int *a, *savea, i; savea = a = (int *) malloc(4 * sizeof(int)); for (i=0; i<4; i++) *a++ = 10 * i; for (i=0; i<4; i++) { printf("%d\n", *savea); savea ++; } return 0; } The output of this two programs will be different why?