+ 3

Name mangling style in c++

Hi I have heard that main function name mangling is always of c style even if we write code in C++. Addition to main function , static variable are also having name mangling as per c style in case of c++ code.. where as extern and global variables will follow c++ name mangling style for c++ code.. Above is always true or it is compiler specific ?

3rd Feb 2020, 5:45 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Respuestas
+ 1
Thank you Akib Reza ... Any thought on external , static and global variable in terms of name mangling ? I presume that along with function names, these are some variables which gets name mangling.
3rd Feb 2020, 1:23 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Yes, they do. I use the MSVC compiler. I think this thread will give you an idea. https://social.msdn.microsoft.com/Forums/en-US/37d86da4-0591-4621-9648-e36b95bfc125/avoid-name-mangling-for-variables-in-c?forum=vclanguage I don't know much about name mangling. This seems also a good explanation- http://web.mit.edu/tibbetts/Public/inside-c/www/mangling.html
7th Feb 2020, 8:52 AM
Akib
Akib - avatar