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

Re: svn commit: r1345740 - /subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp

From: Greg Stein <gstein_at_gmail.com>
Date: Sun, 3 Jun 2012 23:35:08 -0400

On Jun 3, 2012 6:42 PM, "Peter Samuelson" <peter_at_p12n.org> wrote:
>
>
> [Greg Stein]
> > > - int argc = 1;
> > > - app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
> > > + int argc = q_argc;
> > > + app = new QCoreApplication(argc, q_argv);
> >
> > Why keep argc around? Just use q_argc.
>
> Because argc is passed by reference (int &argc) and I figured the only
> reason to do that is if you intend to modify it.

I f'ing hate C++ ... how freaking insane is it when you can't see the
difference between pass-by-value and pass-by-reference?! That you have to
double-check the signature of every call!

Ugh.

> But looking closer, this code is only ever called once, so fair enough.

Nah. Keep the code so the 1 doesn't get changed. You never really know
since you *are* in a library. Maybe more calls will arrive. I'd say, just
add a comment explaining above.

Thanks!

>
> Anyway, those two instances have a lot more duplicate code so I'll
> probably commit a followup soon to de-dupe it, and I'll remove the
> extra variable too.

*nod*

Cheers,
-g
Received on 2012-06-04 05:35:44 CEST

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.