3 ms·
I often use "not", "and", "or" to clearly express logical conditions. Bit operations look better as cryptic symbols "&", "|" and "~". :)
by wmu 5y ago
I often use "not", "and", "or" to clearly express logical conditions. Bit operations look better as cryptic symbols "&", "|" and "~". :)
- usefulcat 5y agoI do this too, as I find it a bit more readable. Also, I find it handy to reserve '&&' exclusively for rvalue references.
- bombela 5y agoSame. `a and b or c` reads nicer than `a && b || c` to me. And I find its harder to typo and misread it: `a && b || c` vs `a & b | c` `a and b or c` vs `a & b | c`
- MaxBarraclough 5y agoA valid opinion for language design, but when writing real C++ code, I'd stick to the usual way of doing things. English language keywords aren't always great for readability in my opinion. Ada's and then / or else syntax, for instance. They're the short-circuit syntax, whereas and and or give eager evaluation. [0] You can't determine that just from the syntax though, so it ends up being no less cryptic than using strange symbols the way C++ (typically) does. [0] https://en.wikibooks.org/wiki/Ada_Programming/Operators#Short-circuit_control_forms https://en.wikibooks.org/wiki/Ada_Programming/Operators#Shor...