Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
163 views
Welcome To Ask or Share your Answers For Others

1 Answer

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;
}

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

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...