VisualStudio 2013 中的替代标记(不是和等)

Alternative tokens (not, and, etc...) in VisualStudio 2013(VisualStudio 2013 中的替代标记(不是和等))

本文介绍了VisualStudio 2013 中的替代标记(不是和等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

not"、and"等……是 C++ 中的关键字(C 中的宏).有什么方法可以在 Visual Studio 2013 中启用"它们?我可以将这些单词用作包含 iso646.h 的宏.但是 VS 似乎无法将它们识别为关键字.

The "not", "and", etc... are keywords in C++ (macros in C). Is there any way to "enable" them in Visual Studio 2013? I'm able to use the words as macroses with iso646.h included. But VS seems not be able to recognize them as keywords.

推荐答案

Using /Za 似乎可以在不包含 iso646.h, 的情况下启用它们://rextester.com/TRT75517" rel="nofollow noreferrer">现场观看,以下程序在不使用 /Za 的情况下产生错误,但在其他情况下工作正常:

Using /Za seems to enable them without including iso646.h, see it live, the following program produces an error without using /Za but works fine otherwise:

int main()
{
    int x = 1, y = 0 ;
    if (x and y)    
    {
    //...  
    }

    return 0;
}

因为 ta.speot.is 表示 /Za 禁用扩展,以下文档表明您必须包含ios646.h 否则:

As ta.speot.is indicates /Za disables extensions, the following documentation indicates you must include ios646.h otherwise:

在/Ze下,如果要使用以下运算符的文本形式,则必须包含iso646.h:

Under /Ze, you have to include iso646.h if you want to use text forms of the following operators:

并在下面列出了替代标记.

and it lists the alternative tokens below.

注意,我知道我以前看过这个,我包含了一个指向 对此的错误报告 在 我的回答> 一个类似的问题.尽管这不包括上述解决方法.

Note, I knew I saw this before, I include a link to a bug report for this in my answer to a similar question. Although this does not include the workaround noted above.

注2:干杯和hth.- Alf 表示关闭扩展可能会产生许多不良后果,因此您最好只包含 iso646.h.

Note 2: Cheers and hth. - Alf indicates that there may be many undesirable consequences to turning off extension and therefore you may be better off just including iso646.h.

这篇关于VisualStudio 2013 中的替代标记(不是和等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:VisualStudio 2013 中的替代标记(不是和等)

基础教程推荐