top | item 26917589

(no title)

wmu | 4 years ago

I often use "not", "and", "or" to clearly express logical conditions. Bit operations look better as cryptic symbols "&", "|" and "~". :)

discuss

order

MaxBarraclough|4 years ago

A 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#Shor...

usefulcat|4 years ago

I do this too, as I find it a bit more readable. Also, I find it handy to reserve '&&' exclusively for rvalue references.

bombela|4 years ago

Same. `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`