In general, what I've observed using nm
on Linux is that T
symbol names (which I'm interested in) stay consistent across different computers even when I'm not using extern "C"
. Is my observation correct?
Note I'm using gcc on all computers.
Name mangling is commonly used to facilitate the overloading feature and visibility within different scopes. The compiler generates function names with an encoding of the types of the function arguments when the module is compiled.
A particular version of a compiler will mangle names consistently, otherwise it wouldn't be able to link with things it produced. Other than that, all bets are off.
Since C is a programming language that does not support name function overloading, it does no name mangling.
In compiler construction, name mangling (also called name decoration) is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages.
It would be very unusual for the computer, the time of day, or the weather to affect name mangling.
What's more likely to cause deviations is differences in compiler version.
But many linux platforms define an ABI (application binary interface) for C++ which includes, among other things, the name mangling rules. On these platforms the same source code will compile to the same mangled names regardless of optimization levels, compiler versions, the hostname, the hard disk serial number, time of day, weather, whether your favorite sports team lost last week, or any factor not explicitly mentioned in the ABI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With