C++ and,or,not,xor 关键字
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2393673/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C++ and,or,not,xor keywords
提问by uray
Possible Duplicate:
The written versions of the logical operators.
可能的重复:
逻辑运算符的书面版本。
I notice that C++ define keyword and, or, not, xor, and_eq, or_eq, not_eqand xor_eqas an alternative to &&, ||, !, ^, &=, |=, !=and |=. and they're rarely used! What's wrong? Are they not portable?
我注意到,c + +定义关键字and,or,not,xor,and_eq,or_eq,not_eq和xor_eq作为替代&&,||,!,^,&=,|=,!=和|=。他们很少使用!怎么了?它们不便携吗?
采纳答案by Maciej Piechotka
They come from C AFAIR from times when it was not known what special symbols are on the keyboard. So to have portable language they were defined so anyone can use C even if (s)he used keyboard with no &, |or ^(etc.).
它们来自 C AFAIR,当时不知道键盘上有什么特殊符号。因此,为了拥有可移植的语言,它们被定义为任何人都可以使用 C,即使(她)使用没有&,|或^(等)的键盘。
Nowadays when QWERTY is a standard (with AZWERTY & co. as variations) it is no longer an issue.
如今,当 QWERTY 成为标准(以 AZWERTY & co. 作为变体)时,它不再是问题。
PS. And of course for obfuscation code competitions ;)
附注。当然还有混淆代码竞赛;)

