473,698 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function Name Mungling

In my opinion, C not mungling its function names imposes unnecessary
complexity on C++, requiring extern 'C' { ... } everywhere in headers.

I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabilit y. Acutally this should have happened long ago.

Regards,
Jim

Jan 6 '08 #1
13 1829
Jim Mackellan wrote:
In my opinion, C not mungling its function names imposes unnecessary
complexity on C++, requiring extern 'C' { ... } everywhere in headers.

I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabilit y. Acutally this should have happened long ago.
Well that would require C++ to use consistent name mangling, which isn't
the case.

--
Ian Collins.
Jan 6 '08 #2
Jim Mackellan wrote:
In my opinion, C not mungling its function names imposes unnecessary
complexity on C++, requiring extern 'C' { ... } everywhere in headers.
Gosh, big complexity. two extra lines per file...
I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabilit y. Acutally this should have happened long ago.
Before that could happen, C++ would need to standardise the
name-mangling rules. It hasn't.

While we're at it, can you require Fortran, Pascal and Assembler (all
variants for all chipsets) to standardise their formats too?

:-)

--
Mark McIntyre

CLC FAQ <http://c-faq.com/>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >
Jan 6 '08 #3
On Sun, 06 Jan 2008 01:02:59 +0100, Jim Mackellan wrote:
I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabilit y. Acutally this should have happened long ago.
There is no need. C implementations are already allowed to and capable of
mangling function and object names in the same way that a specific
implementation of C++ can do, except extended to support unprototyped
function declarations. If they don't, it's not because the C standard
doesn't allow it, or because it's technically impossible, it's simply
because there's not enough demand for it.
Jan 6 '08 #4
>In my opinion, C not mungling its function names imposes unnecessary
>complexity on C++, requiring extern 'C' { ... } everywhere in headers.
Is it *POSSIBLE* for C to mangle function names based on argument
types (interoperabili ty with something else is for the moment put
off for later) and still have legal C programs compile and operate
properly?

I'm specifically thinking of cases where the function is defined
in one source file, is referenced in another source file WITHOUT a
full prototype, and then called with actually correct argument
types. (This is permitted by C99, right?) Will the function
definition and reference always have the SAME mangled name? Since
you don't have a prototype of the function in the file making the
reference, how do you do this?
>I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabili ty. Acutally this should have happened long ago.
I don't think this should happen if it breaks existing C programs.
And I suspect it might. Also, the name mangling should be compatable
with *WHICH* C++ compiler?

Jan 6 '08 #5
In article <sl************ *******@nospam. invalid>,
Jim Mackellan <ji*******@dele ted.invalidwrot e:
>I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabili ty. Acutally this should have happened long ago.
Don't feed the troll, please.

-- Richard
--
:wq
Jan 6 '08 #6
Richard Tobin wrote:
In article <sl************ *******@nospam. invalid>,
Jim Mackellan <ji*******@dele ted.invalidwrot e:
>I believe that in the next version of the ISO standard, C should move to
mungling its function names consistently with C++ to improve
interoperabili ty. Acutally this should have happened long ago.

Don't feed the troll, please.
Isn't that what Sunday afternoons are for?

--
Ian Collins.
Jan 6 '08 #7
Jim Mackellan <ji*******@dele ted.invalidwrot e:
# In my opinion, C not mungling its function names imposes unnecessary
# complexity on C++, requiring extern 'C' { ... } everywhere in headers.
#
# I believe that in the next version of the ISO standard, C should move to
# mungling its function names consistently with C++ to improve
# interoperabilit y. Acutally this should have happened long ago.

Thereby risking some thirty years of binary compatiability.

Do you realize that people are still using software whose source code
is completely disappeared?

--
SM Ryan http://www.rawbw.com/~wyrmwif/
If you plan to shoplift, let us know.
Thanks
Jan 6 '08 #8
In article <13************ *@corp.supernew s.com>
Gordon Burditt <go***********@ burditt.orgwrot e:
>Is it *POSSIBLE* for C to mangle function names based on argument
types (interoperabili ty with something else is for the moment put
off for later) and still have legal C programs compile and operate
properly?
Yes. It requires a trick or two...
>I'm specifically thinking of cases where the function is defined
in one source file, is referenced in another source file WITHOUT a
full prototype, and then called with actually correct argument
types. (This is permitted by C99, right?) Will the function
definition and reference always have the SAME mangled name?
Obviously not -- this is where the trick comes in.
>Since you don't have a prototype of the function in the file making the
reference, how do you do this?
Ultimately, the "link" phase of the translation has to match up
the two functions. The most straightforward method is to have a
"smart linker", which can "de-mangle" names and figure out whether
a "de-mangled" name is to be linked with an "un-adorned" (i.e.,
"never-mangled") name.

To make this more general, one might conceivably use something
similar to weak symbols, where the compiler provides *two* names
for each function: a "fully-qualified" name (one that includes
argument types, i.e., the "mangled" name), and a "low-quality" name
(excluding argument types), along with a directive that ties the
two together. The linker can then proceed with no language-specific
knowledge, by following these "loosely linked" names when exact
matches are unavailable.

A number of existing linkers already "understand " C++ name mangling
to at least some extent, if only to provide human-consumption-form
names in error messages. This means the more-general solution is
not required in practice.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Jan 6 '08 #9

"SM Ryan" <wy*****@tang o-sierra-oscar-foxtrot-tango.fake.orgs chreef in
bericht news:13******** *****@corp.supe rnews.com...
Jim Mackellan <ji*******@dele ted.invalidwrot e:
# In my opinion, C not mungling its function names imposes unnecessary
# complexity on C++, requiring extern 'C' { ... } everywhere in headers.
#
# I believe that in the next version of the ISO standard, C should move to
# mungling its function names consistently with C++ to improve
# interoperabilit y. Acutally this should have happened long ago.

Thereby risking some thirty years of binary compatiability.

Do you realize that people are still using software whose source code
is completely disappeared?
Not that I agree with the troll's proposal but changing the standard does
not suddenly break binaries of which the source is missing
>
--
SM Ryan http://www.rawbw.com/~wyrmwif/
If you plan to shoplift, let us know.
Thanks
Jan 6 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2795
by: Nick Coghlan | last post by:
Time for another random syntax idea. . . So, I was tinkering in the interactive interpreter, and came up with the following one-size-fits-most default argument hack: Py> x = 1 Py> def _build_used(): .... y = x + 1 .... return x, y ....
0
1396
by: schaf | last post by:
Hi ! I'm writing a new xsl:function, which uses two other functions. But by the call of the first function, it would be abort just after the call. Not even the xsl:param would be set. I don't have any idea, why this works like this. Could you please help me ? Here my xsl-code: <xsl:function name="rsh:bestanden">
6
2738
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the work. Nota() - opens new window. fechaNota() - closes the window opened by Nota() here is the code.
12
7001
by: Susan Cranford | last post by:
Please forgive, I have looked at so much info I can't figure out how to put it together even though I know it must be fairly simple. I have an array of input text boxes (txtDOBn) where n is created at load. On the onchange event I want to calc the age and show in adjacent input text boxes that are readonly and also arrays (an age calced for each DOB entered). I was going to use the datediff function in vbscript to do the calc. Can...
6
4406
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the same invocation from a DistantlyRelated class. What actually happened was that the compiler produced: error C2247: 'A::function' not accessible because 'CloselyRelated' uses 'private' to inherit from 'A' I'm guessing that the above compiler...
4
2913
by: poojak | last post by:
I have write two different js function in a external file. one function write a table (I used innerHTML for this.) and another function is for showing/ hideing some rows depending on radio button selection. Both of these function works properly when used in HTML file, but when I use same showhide function in a table which is created by Javascript that function doesn't work at all. I am copying both JS functions here also, If someone can solve...
6
41073
by: Maguila007 | last post by:
Hi Is there any way to obtain the name of the function, inside the function which was called. Ex: function something() { alert( "The name of the function you invoke is " ......should
2
3164
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand whats the prob.this is the code i m using: <? include("config.inc.php"); //error_reporting(0); ...
2
6157
by: WGW | last post by:
Hello all, I need another set of eyes cause it just isn't working, no matter how identical I make it. The initRotator function works when called by itself, but when adding another function, only the "other function" works, not the initRotator function. Here's some examples of what I've tried 1st Example using the 2 functions on body tag: <head> <script src="css/dw_rotator.js" type="text/javascript"></script> <script...
0
8676
marktang
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...
0
8608
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,...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8870
tracyyun
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...
0
7734
agi2029
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...
0
4370
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...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.