Steven Schveighoffer <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #6 from Steven Schveighoffer <> 2010-04-12 
06:09:47 PDT ---
(In reply to comment #1)
> Care to quantify 'frequent'?  Just because something can cause a bug doesn't
> make it a disaster.  I can't recall ever making a bit wise precedence error
> myself.  Of course, that too isn't proof of anything.

I run into this all the time.  It makes me absolutely paranoid about bitops to
where I sometimes write things like:

if((a | b))


a = (b | c);

Before I realize the extra parens don't do much :)

If you write routines that parse protocols or use bitfield flags, you will run
into this bug.

I always wondered why bitwise operators were lower in precedence than
comparison, but you just learn to accept it (and judiciously use parentheses
around such things).  If D could make strides to help solve this problem, I
think it would be great.  Probably not earth shattering, but just another
feather in the cap.  When someone writes something like:

if(a | b == c)

I'd say it's always an error.  Not even almost always, but always.  If D could
flag this as such, it would be a good thing.  I strongly feel, however, that
bitwise ops should simply have a higher precedent than comparison, since the
current behavior is always an error.  You will not find any C code that looks
like this on purpose.  I don't see any reason to keep the current
interpretation regardless.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to