[Mesa-dev] [PATCH 1/2] i965/fs: Use a const reference in fs_reg::equals instead of a pointer.

Olivier Galibert galibert at pobox.com
Fri May 11 14:34:03 PDT 2012


On Fri, May 11, 2012 at 02:25:45PM -0700, Ian Romanick wrote:
> On 05/10/2012 04:10 PM, Kenneth Graunke wrote:
> > This lets you omit some ampersands and is more idiomatic C++.  Using
> > const also marks the function as not altering either register (which
> > was obvious, but nice to enforce).
> 
> I'm increasingly *not* a fan of this sort of weird infix notation. 
> Infix notation really only "reads" if operator symbols are used.  I'd 
> much rather have a friend function.  Instead of
> 
>      if (foo.equals(bar)) {
>      }
> 
> I'd much rather see
> 
>      if (equal(foo, bar)) {
>      }
> 
> But that's just this programmers opinion.

I'd much rather see if (foo == bar) { ... }

Operator overloading, where it makes sense, just makes sense.

  OG.



More information about the mesa-dev mailing list