<legend id='SYnJ6'><style id='SYnJ6'><dir id='SYnJ6'><q id='SYnJ6'></q></dir></style></legend>

  • <i id='SYnJ6'><tr id='SYnJ6'><dt id='SYnJ6'><q id='SYnJ6'><span id='SYnJ6'><b id='SYnJ6'><form id='SYnJ6'><ins id='SYnJ6'></ins><ul id='SYnJ6'></ul><sub id='SYnJ6'></sub></form><legend id='SYnJ6'></legend><bdo id='SYnJ6'><pre id='SYnJ6'><center id='SYnJ6'></center></pre></bdo></b><th id='SYnJ6'></th></span></q></dt></tr></i><div id='SYnJ6'><tfoot id='SYnJ6'></tfoot><dl id='SYnJ6'><fieldset id='SYnJ6'></fieldset></dl></div>
    1. <tfoot id='SYnJ6'></tfoot>

        • <bdo id='SYnJ6'></bdo><ul id='SYnJ6'></ul>

        <small id='SYnJ6'></small><noframes id='SYnJ6'>

        为什么 VS 不为逻辑运算符定义替代标记?

        时间:2023-06-03

        <small id='cunXG'></small><noframes id='cunXG'>

            <bdo id='cunXG'></bdo><ul id='cunXG'></ul>

                <tbody id='cunXG'></tbody>
              <i id='cunXG'><tr id='cunXG'><dt id='cunXG'><q id='cunXG'><span id='cunXG'><b id='cunXG'><form id='cunXG'><ins id='cunXG'></ins><ul id='cunXG'></ul><sub id='cunXG'></sub></form><legend id='cunXG'></legend><bdo id='cunXG'><pre id='cunXG'><center id='cunXG'></center></pre></bdo></b><th id='cunXG'></th></span></q></dt></tr></i><div id='cunXG'><tfoot id='cunXG'></tfoot><dl id='cunXG'><fieldset id='cunXG'></fieldset></dl></div>
            1. <legend id='cunXG'><style id='cunXG'><dir id='cunXG'><q id='cunXG'></q></dir></style></legend>

                  <tfoot id='cunXG'></tfoot>

                • 本文介绍了为什么 VS 不为逻辑运算符定义替代标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  替代令牌有效 c++ 关键字,但在 Visual Studio 2013 中,以下内容会发出编译错误(未声明的标识符):

                  Alternative tokens are valid c++ keywords, yet in Visual Studio 2013 the following emits a compilation error (undeclared identifier):

                  int main(int argc, const char* argv[])
                  {
                      int k(1), l(2);
                      if (k and l) cout << "both non zero
                  ";
                  
                      return 0;
                  }
                  

                  既然and or not 已经存在了很长一段时间,是否有理由不实施它们?

                  Since and or not have been around for quite some time, is there a reason for not implementing them?

                  推荐答案

                  您询问基本原理.这是一个可能的原因,不一定是对 Visual C++ 团队影响最大的原因:

                  You ask about the rationale. Here's one possible reason, not necessarily the one that most influenced the Visual C++ team:

                  1. 那些是 C 中的有效标识符.
                  2. 长期以来,Microsoft 一直建议对 C 和 C++ 代码使用 C++ 模式,而不是维护现代 C 编译器.
                  3. 如果将它们编译为关键字,使用这些作为标识符的有效 C 代码将无缘无故地中断.
                  4. 尝试编写可移植 C++ 的人大多使用 /permissive-/Za 以实现最大的一致性,这将导致它们被视为关键字.
                  5. 通过包含头文件将它们视为 /Ze 中的关键字的解决方法是简单且可移植的.(G++ 的解决方法 -fno-operator-names 也不错,但是将选项放在源代码中而不是构建系统中会更好一些.)
                  1. Those are valid identifiers in C.
                  2. Microsoft's recommendation has long been to use C++ mode for both C and C++ code, rather than maintaining a modern C compiler.
                  3. Valid C code using these as identifiers would gratuitously break if they were compiled as keywords.
                  4. People trying to write portable C++ are mostly using /permissive- or /Za for maximum conformance anyway, which will cause these to be treated as keywords.
                  5. The workaround to treat them as keywords in /Ze by including a header file is easy and portable. (G++'s workaround -fno-operator-names isn't bad either, but putting the option in the source code rather than the build system is somewhat nicer.)

                  这篇关于为什么 VS 不为逻辑运算符定义替代标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MSVC -Wall 标准标题中的数千条警告是怎么回事? 下一篇:为什么空基类优化 (EBO) 在 MSVC 中不起作用?

                  相关文章

                  <small id='71Vkx'></small><noframes id='71Vkx'>

                  <tfoot id='71Vkx'></tfoot>

                  1. <legend id='71Vkx'><style id='71Vkx'><dir id='71Vkx'><q id='71Vkx'></q></dir></style></legend>
                    1. <i id='71Vkx'><tr id='71Vkx'><dt id='71Vkx'><q id='71Vkx'><span id='71Vkx'><b id='71Vkx'><form id='71Vkx'><ins id='71Vkx'></ins><ul id='71Vkx'></ul><sub id='71Vkx'></sub></form><legend id='71Vkx'></legend><bdo id='71Vkx'><pre id='71Vkx'><center id='71Vkx'></center></pre></bdo></b><th id='71Vkx'></th></span></q></dt></tr></i><div id='71Vkx'><tfoot id='71Vkx'></tfoot><dl id='71Vkx'><fieldset id='71Vkx'></fieldset></dl></div>

                      • <bdo id='71Vkx'></bdo><ul id='71Vkx'></ul>