[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: "new" as function parameter doesn't work with C++-compilers

From: David Waite <mass_at_akuma.org>
Date: 2003-06-09 14:51:25 CEST

It is my understanding (and I'm reasonably sure both that I'm right and
that if I'm wrong, someone on the list will tell me quickly ;-)) That
the extern "C" line only affects calling conventions for external
linking, i.e. prevents mangling. For example, if you had a function
named 'new' declared in an extern "C" block., this would not affect
your ability to call from C++ (you still couldn't); it just prevents the
compiler to using whatever name mangling scheme it uses to allow for
operator overloading.

-David Waite

SteveKing wrote:

>----- Original Message -----
>From: "Greg Stein" <gstein@lyra.org>
>To: "SteveKing" <dev@tortoisesvn.tigris.org>
>
>
>>I don't see that at all. Line 67 of svn_wc.h is a comment. I don't see a
>>parameter named 'new' anywhere in the headers.
>>
>>
>
>line 65 to 67 in revision 6174 read:
>typedef svn_error_t *svn_wc_relocation_validator(void *baton,
>
>const char *old,
>
>const char *new);
>
>The problem is the third parameter.
>(file subversion/include/svn_wc.h)
>
>
>
>>Second, we wrap all of our headers with:
>>
>>#ifdef __cplusplus
>>extern "C" {
>>#endif /* __cplusplus */
>>
>>which I would hope avoid problems with identifiers like 'new'. Not that I
>>support doing that when it is so easy to change, but it should prevent
>>problems like you're seeing.
>>
>>
>
>Obviously it didn't. But I'll check my settings...
>Hmmm - I think that only prevents errors in functions, not in typedefs?
>
>
>
>>>...
>>>May I ask to change that?
>>>
>>>
>>Change what? :-)
>>
>>
>
>See above.
>Even with the #ifdef in the header which should prevent
>such errors I strongly recommend not using "new" or any
>other C++ keyword as parameter or variable names.
>
>Stefan
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: dev-help@subversion.tigris.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jun 9 14:52:36 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.