When did quot;andquot; become an operator in C++(“和是什么时候出现的?成为 C++ 中的运算符)
问题描述
我有一些看起来像这样的代码:
I have some code that looks like:
static const std::string and(" AND ");
这会导致 g++ 中的错误,如下所示:
This causes an error in g++ like so:
Row.cpp:140: error: expected unqualified-id before '&&' token
所以在诅咒了将和"定义为&&的傻瓜之后,我添加了
so after cursing the fool that defined "and" as &&, I added
#ifdef and
#undef and
#endif
现在我明白了
Row.cpp:9:8: error: "and" cannot be used as a macro name as it is an operator in C++
这导致我的问题是和"何时成为 C++ 中的运算符?我找不到任何表明它的东西,当然除了来自 g++ 的这条消息
Which leads to my question of WHEN did "and" become an operator in C++? I can't find anything that indicates it is, except of course this message from g++
推荐答案
有几个在 C++ 中定义的此类替代方案.您可能可以使用开关来打开/关闭这些.
There are several such alternatives defined in C++. You can probably use switches to turn these on/off.
这篇关于“和"是什么时候出现的?成为 C++ 中的运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“和"是什么时候出现的?成为 C++ 中的运算符
基础教程推荐
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 常量变量在标题中不起作用 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 我有静态或动态 boost 库吗? 2021-01-01
