By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,937 Members | 1,140 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,937 IT Pros & Developers. It's quick & easy.

name decoration

P: n/a
hi all,

what is the rule for decorating a symbol in c++?
Jul 22 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Bern posted:
hi all,

what is the rule for decorating a symbol in c++?

It's implementation-specific. For instance, there's a
certain way of doing it on Win32. It's commonly referred to
as "name mangling".

-JKop
Jul 22 '05 #2

P: n/a
Bern wrote:
what is the rule for decorating a symbol in c++?


That rule, if any, is implementation specific. I assume you are talking
about name mangling.

Do you have an outer problem, or did you just hear the term "name
decoration" somewhere.

What happens is translation unit A compiles, and its function Foo() turns
into fryingpan_Foo(). Translation unit B compiles extern void Foo(), and its
object file contains a link out to fryingpan_Foo(). The only relevant thing
is the two decorations match; the decorations' contents are irrelevant.

Your compiler author might also write a code browser that reverses the
decoration into its component types.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces
Jul 22 '05 #3

P: n/a
JKop wrote:

Bern posted:
hi all,

what is the rule for decorating a symbol in c++?

It's implementation-specific. For instance, there's a
certain way of doing it on Win32. It's commonly referred to
as "name mangling".


Each compiler, Win32 or otherwise, has its own way of doing name
mangling. Some even call it by a different name, i.e. "name decoration."

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 22 '05 #4

P: n/a
is the name decoration for C compilers standardised?
"Phlip" <ph*******@yahoo.com> wrote in message
news:DZ*************@newssvr15.news.prodigy.com...
Bern wrote:
what is the rule for decorating a symbol in c++?
That rule, if any, is implementation specific. I assume you are talking
about name mangling.

Do you have an outer problem, or did you just hear the term "name
decoration" somewhere.

What happens is translation unit A compiles, and its function Foo() turns
into fryingpan_Foo(). Translation unit B compiles extern void Foo(), and

its object file contains a link out to fryingpan_Foo(). The only relevant thing is the two decorations match; the decorations' contents are irrelevant.

Your compiler author might also write a code browser that reverses the
decoration into its component types.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces

Jul 22 '05 #5

P: n/a
Please don't top-post. Rearranged.

Bern wrote:
Your compiler author might also write a code browser that reverses
the decoration into its component types.


is the name decoration for C compilers standardised?


No. Most of them don't have any AFAIK, because all the C++ language
features that would need it, like classes, namespaces, templates and
function overloading) aren't available in C.

Jul 22 '05 #6

P: n/a
Bern wrote:

is the name decoration for C compilers standardised?


Most C compiler stick an underscore in front of the names of identifiers
that are defined in user code. But that's not standardized. Neither is
name mangling for C++ compilers.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 22 '05 #7

P: n/a
On Sun, 8 Aug 2004 22:32:14 +0800 in comp.lang.c++, " Bern" <x@x.com>
wrote,
hi all,

what is the rule for decorating a symbol in c++?


This issue is covered in Marshall Cline's C++ FAQ. See the topic
"[37.9] If name mangling was standardized, could I link code compiled
with compilers from different compiler vendors?" It is always good to
check the FAQ before posting. You can get the FAQ at:
http://www.parashift.com/c++-faq-lite/
Jul 22 '05 #8

P: n/a

"Rolf Magnus" <ra******@t-online.de> wrote in message news:cf*************@news.t-online.com...
No. Most of them don't have any AFAIK, because all the C++ language
features that would need it, like classes, namespaces, templates and
function overloading) aren't available in C.

In actuality, trivial decoration IS added in most C compilers. Global C
symbols get underscores prepended to them to avoid collision with other
runtime symbols (mostly historical).

Jul 22 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.