Defining Keywords in Visual C++
Keywords are predefined reserved identifiers that have special meanings. They cannot be used as identifiers in your program; however, you can define your own keywords to use in Visual C++, and you can assign customized syntax coloring to the keywords. Syntax coloring gives you visual cues about the structure and state of your code.
To define your own Visual C++ keywords
- Using the Visual Studio Code and Text Editor or Windows Notepad, create a text-only file and save it with the name, usertype.dat.
- In the file, usertype.dat, type each keyword on a separate line.
- Save usertype.dat in the same directory as devenv.exe, as a text-only file.
- Exit and restart Visual Studio.
Note You cannot rename or reload the usertype.dat file during an editing session because it is read during initialization. All previously defined color settings take precedence as the syntax coloring mechanism checks the usertype.dat file last.
- In the Tools Options dialog box, in the Display items box, select User keyword.
- Set the font and color properties for the new keywords as described in Fonts and Colors, Environment, Options Dialog Box.
For more information, see C++ Keywords in the C++ Language Reference.