A
Angel Tsankov
Can someone give a reason why bitwise operators (&,^,|) have lower
precedence than equality/inequality test oeprators (==, !=)?
precedence than equality/inequality test oeprators (==, !=)?
Angel said:Can someone give a reason why bitwise operators (&,^,|) have lower
precedence than equality/inequality test oeprators (==, !=)?
Victor said:You need to ask Brian Kernighan or Dennis Ritchie. It is the same way in
C++ as it is in C. If I were to speculate, I'd say that initially the
(now bitwise) operators were used for "logical" conditions as well, that's
how they got lower precedence than equality. Later && and || were added
to C (with even lower precedence than bitwise ones). Nobody cared (or was
courageous enough) to change the bitwise ones. Of course, there can exist
another explanation.
V
Angel said:Can someone give a reason why bitwise operators (&,^,|) have lower
precedence than equality/inequality test oeprators (==, !=)?
Kaz said:A better question is why:
(obj->*pmemb)(arg1, ...); // <expletive deleted> stupid!
versus
obj->pfunc(arg1, ...);
Greg said:How would ambiguity be handled with such a syntax? Consider:
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.