Are “not, and, or, not_eq..” part of the C++ standard? (And why might they be used or avoided in code?)

后端 未结 5 1797
無奈伤痛
無奈伤痛 2021-01-12 23:44

So it looks like all these: http://www.cplusplus.com/reference/clibrary/ciso646/ are keywords in c++.

My question is. Is this a part of the c++ standard?

Ca

5条回答
  •  庸人自扰
    2021-01-13 00:43

    Yes, they are supported.

    In terms of the second half of your question they can lead to more readable code especially when dealing with bitwise operators as well as logical operations at the same time for example:

    if( a & 1 == 0 || c | a == 2 );
    

    vs

    if( a & 1 == 0 or c | a == 2 );
    

提交回复
热议问题