^ operator

S

Stefan L

Pavel said:
They do know the tables. My point is that in C, ^ is always bitwise,
never proper boolean (and you might want to consider why there wasn't
^^ analogous to || and &&). Not that many people with C background
know that in C#, ^ actually works on boolean values the way you'd
expect it to do.

There can NEVER be a ^^ as it is impossible to evaluate a xor term
without looking at both operands!
The funny thing about && and || is that they stop evaluating if the
first operand is satisfactory to know the result.

PS: I like ^, too... ;-)
 
B

Ben Voigt [C++ MVP]

Stefan said:
There can NEVER be a ^^ as it is impossible to evaluate a xor term
without looking at both operands!
The funny thing about && and || is that they stop evaluating if the
first operand is satisfactory to know the result.

In C# the short-circuit is the primary difference between & and &&, the
original behavior in C (and matching behavior in C++ and probably also Java
and ECMAScript) other differences are at least as important.
 

Ask a Question

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.

Ask a Question

Top