On Tue, 28 Aug 2018, Michael Matz wrote:
> > I think it's not too complicated, but how about adding this comment:
> > 
> >   profile_count m = c1.max (c2);
> >   /* Return 0 if counts are equal, -1 if E1 has the larger count.  */
> >   return (m == c2) - (m == c1);
> > 
> > Or, alternatively, employ more branchy checks:
> > 
> >   if (c1 == c2)
> >     return 0;
> >   if (c1 == c1.max (c2))
> >     return -1;
> >   return 1;
> 
> You want to at least comment on why a tradition </>/== check isn't 
> working, namely because of the uninitialized counts.

Alright, so how about this comment:

  /* Using 'max', as profile_count::operator< does not establish
     a strict weak order when uninitialized counts may be present.  */
  profile_count m = c1.max (c2);
  return (m == c2) - (m == c1);

Or the same comment in the "branchy" alternative.

Thanks.
Alexander

Reply via email to