[Mesa-dev] [PATCH] r600: Flip point sprite coordinates when rendering to an FBO.

Henri Verbeet hverbeet at gmail.com
Tue Jul 20 10:48:18 PDT 2010


On 20 July 2010 01:02, Dave Airlie <airlied at gmail.com> wrote:
> Its abuse because if you read that your brain would have to go wtf at
> least twice,
>
> I don't mind !!, since your brain can deal with that, but using binary
> operators where you really want logical is really bad for the reader.
>
> Open source code should be optimised for readers not writers.
>
Sure, I actually agree with following whatever style / conventions a
specific project prefers, no argument there. I've sent an updated
patch.

OT at this point, I'd like to explain my point of view though:
  - != isn't equivalent to "logical xor". Logical xor would evaluate
to 0 for "a xor b" for any non-zero a and b. != clearly doesn't do
that, except for the cases where it's equivalent to ^.
  - != isn't a logical operator at all, it's a relational operator.
  - The main, significant, difference between logical operators and
their bitwise equivalents is short-circuit behaviour. Otherwise e.g.
"a && b" is equivalent to "!!a & !!b". Since short-circuit doesn't
make sense for xor, it's perhaps not surprising that C doesn't have a
concept of "logical xor", it would be redundant.

So since the meaning of that line is "either one or the other", I
figured a xor expressed that more clearly than an equality operator.


More information about the mesa-dev mailing list