my question is rather theoretical than practical in the pure programming
aspect...
is "name mangling" the same as "name decorating" ?
browsing the web, you might find multiple people saying "yes", but i
vaguely remember having read that it's not exactly like that
one might say that "name mangling" is a part of c++ compiler specification
and is a naming scheme to support function overloading
"name decorating" on the other side, could be a part of a calling
convention naming scheme that supports symbol binding on the operating
system level
both affect the way given symbol is represented in the binary image, and
thus share a common field of operation, but still would denote a different
mechanism, at least considering its purpose...
are the terms perfectly equal ? 6 6528 yy*@yyy.yyy wrote: my question is rather theoretical than practical in the pure programming aspect...
If it's not C++-language specific, it doesn't belong here, then.
is "name mangling" the same as "name decorating" ?
AFAIK. The beauty is in the eye of the beholder. You decorate my
room and if I don't like it, I'll say that you've mangled it. :-)
browsing the web, you might find multiple people saying "yes", but i vaguely remember having read that it's not exactly like that
one might say that "name mangling" is a part of c++ compiler specification and is a naming scheme to support function overloading
"name decorating" on the other side, could be a part of a calling convention naming scheme that supports symbol binding on the operating system level
Yes, it could. How is it different?
both affect the way given symbol is represented in the binary image, and thus share a common field of operation, but still would denote a different mechanism, at least considering its purpose...
are the terms perfectly equal ?
Of course not. Names are changed differently depending on where the
change has meaning, right? Wait... If we're talking of the fact that the
original name is changed (supplied with additional information) to reflect
the use of the name, then there is no difference, the name _is_ changed,
regardless of why it was necessary, right?
<yy*@yyy.yyy> wrote in message news:opswqhav0r iafrhz@q-0ipvqbesgeo8i.. . my question is rather theoretical than practical in the pure programming aspect...
is "name mangling" the same as "name decorating" ?
browsing the web, you might find multiple people saying "yes", but i vaguely remember having read that it's not exactly like that
one might say that "name mangling" is a part of c++ compiler specification and is a naming scheme to support function overloading
"name decorating" on the other side, could be a part of a calling convention naming scheme that supports symbol binding on the operating system level
both affect the way given symbol is represented in the binary image, and thus share a common field of operation, but still would denote a different mechanism, at least considering its purpose...
are the terms perfectly equal ?
I am not able to answer you question fully, but a guess would be that name
decoration is what happens when you compile your C program and every symbol
has an _ (underscore) prefixed because that is just the way C compilers
sometimes do (of course this is entirely up to the compiler).
Name mangling, at least to my knowledge, is what the C++ compiler does to
every function name because you may have multiple overloads and functions
whose names are the same inside different classes - this way the name
mangling of a symbol in some way reflects the types of arguments and the
class to which it belongs.
Still, I do not _know_ this, this is just what I imagine :o)
If someone actually knows this, please enlighten all of us...
Regards,
Mogens yy*@yyy.yyy wrote: my question is rather theoretical than practical in the pure programming aspect...
is "name mangling" the same as "name decorating" ?
"Name mangling" is the term used in the C++ world from time immemorial
(i.e. since the creation of cfront). Microsoft, being Smarter Than
Everyone Else (tm), decided to use the term "name decorating." Unless
you, too, are Smarter Than Everyone Else (tm), you can use them
interchangeably .
--
Pete Becker
Dinkumware, Ltd. ( http://www.dinkumware.com)
Something that calls itself yy*@yyy.yyy wrote: Is "name mangling" the same as "name decorating"?
Browsing the web, you might find multiple people saying "yes" But I vaguely remember having read that it's not exactly like that.
One might say that "name mangling" is a part of C++ compiler specification and is a naming scheme to support function overloading.
"name decorating", on the other side, could be a part of a calling convention naming scheme that supports symbol binding on the operating system level.
Both affect the way given symbol is represented in the binary image, and, thus, share a common field of operation but still would denote a different mechanism, at least considering its purpose.
Are the terms perfectly equal?
A function name *may* be mangled by simply "decorating " it
with prefixes and/or suffixes to the generate symbols
that the compiler leaves behind for the link editor.
The so-called "UNIX convention" for Fortran prescribes:
1.) converting the function name to lower case and
2.) appending a single underscore to the function name.
Name mangling is necessary only to provide a unique symbol
for each function so that, for example, the link editor
can distinguish a Fortran subprogram from a C function
with the same name.
C++ function names are "mangled" (usually just decorated) because
the link editor accepts only a restricted set of identifiers as symbols.
There is no real reason why link editors couldn't be modified
to accept a function signature, for example:
strtok(char*, const char*)
as an entry in its symbol table.
E. Robert Tisdale napisal(a): Something that calls itself yy*@yyy.yyy wrote:
Is "name mangling" the same as "name decorating"?
Browsing the web, you might find multiple people saying "yes" But I vaguely remember having read that it's not exactly like that.
One might say that "name mangling" is a part of C++ compiler specification and is a naming scheme to support function overloading.
"name decorating", on the other side, could be a part of a calling convention naming scheme that supports symbol binding on the operating system level.
Both affect the way given symbol is represented in the binary image, and, thus, share a common field of operation but still would denote a different mechanism, at least considering its purpose.
Are the terms perfectly equal?
A function name *may* be mangled by simply "decorating " it with prefixes and/or suffixes to the generate symbols that the compiler leaves behind for the link editor. The so-called "UNIX convention" for Fortran prescribes:
1.) converting the function name to lower case and 2.) appending a single underscore to the function name.
Name mangling is necessary only to provide a unique symbol for each function so that, for example, the link editor can distinguish a Fortran subprogram from a C function with the same name. C++ function names are "mangled" (usually just decorated) because the link editor accepts only a restricted set of identifiers as symbols. There is no real reason why link editors couldn't be modified to accept a function signature, for example:
strtok(char*, const char*)
as an entry in its symbol table.
i've always considered "name mangling" a technical term, describing a
mechanism specific only to c++, and possibly other objective languages,
that tries to remedy the fact, that due to language specification
(overloading), an atom identifier at compiler level was not enough to
distinguish between procedures having same names but different set of
arguments. From your answer i get the impression that "decorating "
stands for some *practical* means of satisfying a *logical* concept of
"mangling".
the question was inspired in some degree, by microsoft's msdn entries,
as one of the previous posts hinted, where "name decorating" was used
in the context of calling conventions. at least in the ms compiler the
calling convention does affect the binary symbols generated when
compiled as standard c, or for c++ functions with the 'extern "C"'
directive.
cdecl: prepended with an underscore
stdcall: gets appended an "at sign" followed by the number of bytes
pushed on stack
fastcall: like stdcall, but gets an additional "at" at the beginning
so, would the names in this case be mangled, decorated, both, none or
"can't really say" ?
Something that calls itself yy*@yyy.yyy wrote: I've always considered "name mangling" a technical term describing a mechanism specific only to C++ and, possibly, other objective languages that tries to remedy the fact that, due to language specification (overloading), an atom identifier at compiler level was not enough to distinguish between procedures having same names but different set of arguments. From your answer, I get the impression that "decorating " stands for some *practical* means of satisfying a *logical* concept of "mangling".
The question was inspired in some degree by microsoft's msdn entries as one of the previous posts hinted where "name decorating" was used in the context of calling conventions. At least in the ms compiler, the calling convention does affect the binary symbols generated when compiled as standard C or for C++ functions with the 'extern "C"' directive.
cdecl: prepended with an underscore stdcall: gets appended an "at sign" followed by the number of bytes pushed on stack fastcall: like stdcall, but gets an additional "at" at the beginning
So, would the names in this case be mangled, decorated, both, none or "can't really say"?
I can't speak to any special meaning that Microsoft programmers
may have attached to the terms "mangle" or "decorate".
If you don't actually change the name
but simply prepend prefixes or append suffixes,
then you can say that the name is "decorated" .
If you actually modify the name
(convert it to all lower case for example),
then you must say that the name has been mangled.
The C++ standards do *not* specify any particular name mangling rules.
Name mangling and the meaning of mangled names
is implementation dependent and off-topic in comp.lang.c++ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sunny |
last post by:
Hi,
I was trying to call a function in an an asm file from a C
file(driver).
In c file the funcrtion is defined as:
extern int foo(int,int);
In the asm file the function is defined as _foo.
when I link the 2 binaries in VC++ it works fine but with DDK this
gives as error saying _foo@8 not found.
|
by: Bern |
last post by:
hi all,
what is the rule for decorating a symbol in c++?
|
by: Tim Slattery |
last post by:
Does the C++ language standard mandate a particular name-mangling
method?
I'm trying to use the Entrust toolkit to create a C++ program that
encrypts and decrypts files. Entrust supplies header files defining
their objects and functions, and *.so files (I'm on a Sun Sparc
machine running Solaris) containing the implementation of the
functions.
I'm compiling with the GNU g++ compiler. According to the
|
by: Randy Yates |
last post by:
Why is this necessary? The identifiers provide by the
programmer are unique, and that is what is important - why
map what the user has specified to something else?
--
Randy Yates
Sony Ericsson Mobile Communications
Research Triangle Park, NC, USA
randy.yates@sonyericsson.com, 919-472-1124
|
by: David Wade |
last post by:
Folks,
Does any one know of any "name mangling" software that allows standard C
with long names to be linked? Any suggestions for a better place to look? I
have tried putting various searchs into google to no avail.
Dave.
| |
by: Subhransu Sahoo |
last post by:
Hi All,
Does the C++ standard tell function overloading can't be done with the
return types of two functions ? If so, is it true that the name
mangling scheme does not take the return type into account ?I know that
C++ standard does not tell anything about name mangling and only talks
bout function overloading. But, I have observed that the Metrowerks
Code Warrior compiler does take return type into the mangling scheme.
Is it not a bug...
|
by: sam_cit |
last post by:
Hi Everyone,
I read somwhere that c++ compiler does name mangling of functions
which is why c source code can't invoke functions from object files
that were generated using c++ compiler. Can anyone tell in detail as to
what name mangling is all about?
|
by: jason.cipriani |
last post by:
Does anybody know if C++0x is going to change C++ name mangling at
all? Such as, standardizing name mangling instead of leaving it up to
the compiler?
Jason
|
by: Megalo |
last post by:
why not make "name mangling" of C++ standard so should be possible
to call
the classes and the functions of C++ from other C++ compiler
thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |