On Jun 3, 2012 6:42 PM, "Peter Samuelson" <pe...@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

Reply via email to