【问题标题】:What kind of operator are "not", "and" and "or" in C++ [duplicate]C ++中的“非”,“与”和“或”是什么样的运算符[重复]
【发布时间】:2016-04-26 13:39:21
【问题描述】:

'因为每当我尝试这些行之一时:

#define and &&
#define or ||
#define not !

我得到错误:

1:9: error: "not"/"and"/"or" cannot be used as a macro name as it is an operator in C++

【问题讨论】:

  • 为什么...你会想要定义这些吗?为什么让你的代码不可读?
  • 不可读?来吧。
  • Unexpected 是不可读的。我打赌接下来你会做#define loop for
  • 不。 #define for for( 对我来说已经足够了

标签: c++ operator-overloading operators user-defined


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-25
    • 2021-04-14
    • 1970-01-01
    • 2020-05-26
    • 2017-05-08
    • 2013-06-27
    • 1970-01-01
    • 2011-04-17
    相关资源
    最近更新 更多