On Wed, Jul 16, 2014 at 10:40:53PM -0400, Trevor Saunders wrote:
> > +++ b/gcc/inchash.h
> > +class inchash
> > +{
> > +  hashval_t val;
> 
> normal style would be explicit private: at the end.

Ok.

> 
> > + public:
> > +
> > +  /* Start incremential hashing, optionally with SEED.  */
> > +  void begin (hashval_t seed = 0)
> > +  {
> > +    val = seed;
> 
> why isn't this the ctor?

It's standard for hash classes to have explicit begin()/end().
All the existing ones I've seen work this way.

> 
> > +  /* Add unsigned value V.  */
> > +  void add_int (unsigned v)
> > +  {
> > +    val = iterative_hash_hashval_t (v, val);
> > +  }
> 
> istm this is a great spot to provide a bunch of overloads of just add()
> and let the compiler pick the appropriate one for your type.

Sorry I'm not into code obfuscation. With hashing it's far better
to work with explicit visible types instead of invisible magic.

-Andi

Reply via email to