What logical operators in C ++ do you use: and, or, rather than, and needle or C-style operators? What for?

a matter of rest / curiosity, as the name implies.

I personally prefer new operators to make the code more readable in my opinion.

Which ones do they use? What is the reason for choosing one of them?

Emacs also highlights these statements in different ways, so I get more visual feedback when viewing the screen. I know that old statements can also be highlighted, but ISO646 is highlighted by default

+5
source share
6 answers

, , , , . , , , , - . C/++.

, , , C ++, - ! .

+6

, - C/++, . ; -C-ish.

+11

not !, :

if (not condition()) {
}

if (!condition()) {
}

!. , ( #define d) , .

and or , .

+8

, iso646.h?

C, , . , "" , , .

&& "" . ( , .)

+3

.

: Perl , , . - , &&, || ! , .

+2

Alternative tokens for the logical (and not only logic) operators such as and, or, notetc., have nothing to do with C ++. They were also present in C from almost the beginning. If you want to use them in your code, you can do it, but don't be surprised if people find this practice pretty unorthodox. Typically, people use conventional pointers for these operators (e.g. &&, ||etc.) As in C code, and C ++.

+1
source

All Articles