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.

- 154,301
- 39
- 440
- 740

- 2,084
- 1
- 26
- 40
-
*I'm able to use the words as macroses with iso646.h included. But VS seems not be able to recognize them as keywords.* Are you saying it works but you don't get syntax highlighting? – ta.speot.is Sep 24 '14 at 03:31
-
@ta.speot.is: He's saying that in C++ it should recognize them as keywords *without* a header, but right now he has to use a header to get it to recognize them. – Jerry Coffin Sep 24 '14 at 03:32
-
1Keep in mind that "VS" is Visual Studio which is not a compiler. *But VS seems not be able to recognize them as keywords.* And if what you say is correct, that's totally expected according to the manual http://msdn.microsoft.com/en-us/library/1k6w8551.aspx *The not operator is the text equivalent of !. There are two ways to access the not operator in your programs: include the header file iso646.h, or compile with the /Za (Disable language extensions) compiler option.* – ta.speot.is Sep 24 '14 at 03:33
-
1Try with the /Za option – quantdev Sep 24 '14 at 03:34
3 Answers
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
.

- 1
- 1

- 154,301
- 39
- 440
- 740
-
1it's not a good idea to to turn off visual c++ extensions, because then it's likely that much microsoft code will not compile. instead use a forced include of iso646.h – Cheers and hth. - Alf Sep 24 '14 at 03:59
-
@Cheersandhth.-Alf thank you for the comment, adjusted answer. I am curious do you have any examples? – Shafik Yaghmour Sep 24 '14 at 04:06
-
1
Use a forced include (option /FI
) of the iso646.h
header.
For work in the command interpreter you can put this in your CL
environment variable, or e.g. in a response file.
Turning off Visual C++ language extensions with /Za
can also do the trick, at the cost of rendering the compiler pretty much useless – since Microsoft code such as the Windows API headers generally uses the extensions.

- 142,714
- 15
- 209
- 331
On a more recent version of VS (tested on Version 15.7.0 Preview 3.0); ensure that conformance mode is set for visual studio:
It then compiles with the alternative operator representations.

- 10,717
- 5
- 39
- 72