Debian Developers - When is the C++ transition needed?

This is Interesting: Free IT Magazines  
Home > Archive > Debian Developers > October 2005 > When is the C++ transition needed?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author When is the C++ transition needed?
Henning Makholm

2005-10-06, 6:04 pm

I notice that the newest upload of pstoedit has reverted the C++
transition name change; instead of libpstoedit0c2 sid now contains
libpstoedit0, as in sarge.

However, the library exports things with interfaces such as

#ifdef __cplusplus
extern "C" DLLEXPORT
int pstoeditwithghostscript(int argc,
const char *
const argv[],
ostream& errstream,
const DescriptionRegister* const pushinsPtr=0
);
#endif

Does this not need transitioning for the ABI change?

For example, if an existing client program passes a subclass of
libstdc++5's ostream as the 'errstream' parameter, will the libstdc++6
version of libpstoedit0 know how to call its methods correctly?

If the answer is, "don't fear, this will actually work", then where is
that documented? And shouldn't the reasoning be referenced from the
pstoedit changelog, anyway?

--
Henning Makholm "So you're nostalgic for a whole two-month period?"


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Brian M. Carlson

2005-10-06, 6:04 pm

Olaf van der Spek

2005-10-06, 6:04 pm

On 10/6/05, Brian M. Carlson <sandals@crustytoothpaste.ath.cx> wrote:
> On Thursday 06 October 2005 12:45, Henning Makholm wrote:
>
> This is, IMHO, incorrect.
>
>
> You must not pass by reference with an extern "C" declaration, because C
> doesn't support that.


ostream sounds like C++ too.
Daniel Jacobowitz

2005-10-06, 6:04 pm

On Thu, Oct 06, 2005 at 05:35:34PM +0000, Brian M. Carlson wrote:
> On Thursday 06 October 2005 12:45, Henning Makholm wrote:
>
> This is, IMHO, incorrect.
>
>
> You must not pass by reference with an extern "C" declaration, because C
> doesn't support that.


Why not? An extern C definition doesn't mean that it needs to be
usable from C. It just means to use the C calling convention.

--
Daniel Jacobowitz
CodeSourcery, LLC


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Nathanael Nerode

2005-10-07, 2:57 am

Brian Carlson wrote:
Dan Jacobowitz wrote:[vbcol=seagreen]
>Why not? An extern C definition doesn't mean that it needs to be
>usable from C. It just means to use the C calling convention.

Perhaps because there is no C calling convention for passing by reference?
How to pass arguments is part of the calling convention. :-P You can pass
C++-only objects, certainly, but you have to be able to pass them in a way
which is understood in the C calling convention.

--
Nathanael Nerode <neroden@twcny.rr.com>

Make sure your vote will count.
http://www.verifiedvoting.org/


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Henning Makholm

2005-10-07, 8:48 pm

Scripsit "Brian M. Carlson" <sandals@crustytoothpaste.ath.cx>
> On Thursday 06 October 2005 12:45, Henning Makholm wrote:


[vbcol=seagreen]
> This is, IMHO, incorrect.


It is how I interpret these changes files snippes from the PTS:

Date: Thu, 29 Sep 2005 21:42:12 +0200
Source: pstoedit
Binary: pstoedit libpstoedit-dev libpstoedit0
Architecture: source i386
Version: 3.42-1
[...]
Changes:
pstoedit (3.42-1) unstable; urgency=low
Henning Makholm

2005-10-08, 8:48 pm

Scripsit "Brian M. Carlson" <sandals@crustytoothpaste.ath.cx>
> On Thursday 06 October 2005 12:45, Henning Makholm wrote:


[vbcol=seagreen]
[vbcol=seagreen]
> It does need transitioning.


Having discovered that the lack of transitioning actually does lead to
real breakage, I have now filed a bug, #332859.

--=20
Henning Makholm "Manden med det store pindsvin er
kommet vel ombord i den gr=F8nne dobbeltd=E6k=
ker."
Daniel Jacobowitz

2005-10-24, 4:22 pm

On Thu, Oct 06, 2005 at 09:24:19PM -0400, Nathanael Nerode wrote:
> Brian Carlson wrote:
> Dan Jacobowitz wrote:
> Perhaps because there is no C calling convention for passing by reference?
> How to pass arguments is part of the calling convention. :-P You can pass
> C++-only objects, certainly, but you have to be able to pass them in a way
> which is understood in the C calling convention.


That's incorrect. The C++ ABI uses a defined convention for passing by
reference, and with a different prototype and some care, or from
assembly, you can duplicate the effect.

The primary effect of extern "C" is just disabling mangling.

--
Daniel Jacobowitz
CodeSourcery, LLC


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com