leisure/curiosity question as implied in the title.
I personally prefer the new operators as to make code more readable in my opinion.
Which ones do use yourself? What is your reason for choosing one over the other one?
also Emacs highlights those operators differently so I get more visual feedback when looking at the screen. I know the old operators can be highlighted as well but the ISO646 highlighted by default
C) AND (&&) > OR (||) > NOT (!) D) AND (&&) = OR (||) > NOT (!) Explanation: Logical NOT Operator in C has the highest priority.
Remarks. The logical AND operator ( && ) returns true if both operands are true and returns false otherwise. The operands are implicitly converted to type bool before evaluation, and the result is of type bool .
I don't think I have ever even seen C/C++ source code that actually uses the alphabetic operators. To me, it just looks strange; very un-C-ish.
I prefer to use not
instead of !
because it's a lot more readable:
if (not condition()) {
}
versus
if (!condition()) {
}
The !
kind of gets lost in there. Of course, this must be avoided (or #define
d) when writing code intended to be portable.
However, and
and or
don't do much for me, so I don't use them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With