You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by SteveKing <st...@gmx.ch> on 2003/06/09 07:59:45 UTC
"new" as function parameter doesn't work with C++-compilers
Hi,
Just updated to HEAD of subversion and
tried to compile it. But I got compiler errors
in the file svn_wc.h, line 67 because "new"
is a C++ keyword and shouldn't be used
as a parameter name.
(subversion itself compiles fine, but I'm using
subversion in my own client which is written
in C++ and that's what my compiler hates)
May I ask to change that?
I think I could convince my compiler to
treat that file as pure C instead of C++,
but I guess it's easier to change the parameter
name.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: "new" as function parameter doesn't work with C++-compilers
Posted by David Waite <ma...@akuma.org>.
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" <gs...@lyra.org>
>To: "SteveKing" <de...@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
Re: "new" as function parameter doesn't work with C++-compilers
Posted by SteveKing <st...@gmx.ch>.
----- Original Message -----
From: "Greg Stein" <gs...@lyra.org>
To: "SteveKing" <de...@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
Re: "new" as function parameter doesn't work with C++-compilers
Posted by Branko Čibej <br...@xbc.nu>.
Greg Stein wrote:
>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.
>
Nope, "new" is a keyword in C++; the extern declaration doesn't affect it.
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: "new" as function parameter doesn't work with C++-compilers
Posted by Greg Stein <gs...@lyra.org>.
On Mon, Jun 09, 2003 at 09:59:45AM +0200, SteveKing wrote:
> Hi,
>
> Just updated to HEAD of subversion and
> tried to compile it. But I got compiler errors
> in the file svn_wc.h, line 67 because "new"
> is a C++ keyword and shouldn't be used
> as a parameter name.
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.
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.
>...
> May I ask to change that?
Change what? :-)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: "new" as function parameter doesn't work with C++-compilers
Posted by SteveKing <st...@gmx.ch>.
----- Original Message -----
From: "mark benedetto king" <mb...@lowlatency.com>
> > Just updated to HEAD of subversion and
> > tried to compile it. But I got compiler errors
> > in the file svn_wc.h, line 67 because "new"
> > is a C++ keyword and shouldn't be used
> > as a parameter name.
> >
>
>
> Fixed in rev 6175.
>
Thanks a lot!
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: "new" as function parameter doesn't work with C++-compilers
Posted by mark benedetto king <mb...@lowlatency.com>.
On Monday, June 9, 2003, at 03:59 AM, SteveKing wrote:
> Hi,
>
> Just updated to HEAD of subversion and
> tried to compile it. But I got compiler errors
> in the file svn_wc.h, line 67 because "new"
> is a C++ keyword and shouldn't be used
> as a parameter name.
>
Fixed in rev 6175.
--ben
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org