[PATCH] Fix iterator bug in choose.cc

Robert Collins rbcollins@cygwin.com
Thu Mar 13 21:18:00 GMT 2003


On Fri, 2003-03-14 at 08:07, Igor Pechtchanski wrote:
> On 14 Mar 2003, Robert Collins wrote:
> 
> > On Fri, 2003-03-14@07:47, Igor Pechtchanski wrote:
> > > I noticed there is a bug in an iterator in choose.cc that causes "All" to
> > > be printed twice in the list of categories in setup.log.full.  The
> > > attached patch fixes that.  Note that, like the original, the patch will
> > > not work if a package is not in any category (but that shouldn't happen
> > > anyway, right?).
> > >       Igor
> > > ==============================================================================
> > > 2003-03-13  Igor Pechtchanski <pechtcha@cs.nyu.edu>
> > >
> > >       * choose.cc (ChooserPage::OnNext): Fix iterator bug.
> >
> > Nice catch. Wouldn't
> >             = pkg.categories.begin ();
> > ->          String all_categories = *(i++);
> >
> > Be an easier fix?
> 
> It's shorter, but I dislike the use of increment operators outside of
> loops.  Leads to obscure errors.  Personal preference, y'know... :-)
> But it's your preference that counts, so feel free to tweak it.
> 	Igor

I will :}.

The reason in this case, is that (IMO) it's more clear to a casual
reader that we copy and increment, rather than copy, then loop beginning
with an increment on each cycle. And whats clears to a casual reader is
blindingly obvious to us :}.

Rob

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20030313/68c3cbaf/attachment.sig>


More information about the Cygwin-apps mailing list