问题描述
为什么逻辑运算符的书写版本没有更广泛地使用?我知道为什么它们存在(为了消除与编程早期的QWERTY键盘相关的问题),但它们似乎是一个语法糖否则丑陋的运算符。在 auto
和基于范围的for-loops的这一天,当和$ c $时使用一个丑陋 c>
和
或。
C ++ 学生比
&&
更直观。同样,或
等效于 ||
。 我找到了答案,特别是以下blockquote启发:
这基本上对我说人们不使用他们,所以他们不期望他们,这似乎很奇怪,因为和
(至少对我来说)比使用&&
更直观。
我使用它们,我敦促人们也使用它们。这真的是所有的。几个人使用它们的原因是(a)历史和(b)Visual C ++不能识别它们,并且要求用户包括< ciso646>
。 这是一个错误这是Microsoft认可但拒绝修复。
这真的是所有关于他们。
Why are the written versions of the logical operators not more widely used? I understand why they exist (to eliminate problems associated with QWERTY keyboards in the early days of programming), but they seem like a syntactic sugar to otherwise "ugly" operators. In this day of auto
and range based for-loops, it seems counter intuitive to use a an "ugly" operator when and
and or
are available.
Surely and
is more intuitive to a beginning C++
student than &&
. Likewise with or
being equivalent to ||
.
I've found this answer, particularly the following blockquote enlightening:
Which basically says to me "people don't use them so they don't expect them", which seems strange to be because and
(to me, at least) is more intuitive than using &&
.
I use them, and I urge people to use them, too. That’s really all there is to it. The reason for few people using them is (a) historical and (b) Visual C++ does not recognise them, and requires the user to include <ciso646>
. That’s a bug which Microsoft recognises but refuses to fix.
That’s really all there is to say about them.
这篇关于为什么逻辑运算符的书面版本不会更广泛地使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!